Motr  M0
btree_internal.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_BE_BTREE_INTERNAL_H__
26 #define __MOTR_BE_BTREE_INTERNAL_H__
27 
34 #include "format/format.h" /* m0_format_header */
35 #include "be/btree.h" /* BTREE_FAN_OUT */
36 #include "be/btree_xc.h" /* m0_be_btree_backlink_xc */
37 
38 /* btree constants */
39 enum {
40  KV_NR = 2 * BTREE_FAN_OUT - 1,
41 };
42 
44  void *btree_key;
45  void *btree_val;
46 } M0_XCA_RECORD M0_XCA_DOMAIN(be);
47 
48 /* WARNING!: fields position is paramount, see node_update() */
49 struct m0_be_bnode {
50  struct m0_format_header bt_header; /* Header of node */
52  struct m0_be_bnode *bt_next; /* Pointer to next node */
53  unsigned int bt_num_active_key;/* Count of active keys */
54  unsigned int bt_level; /* Level of node in B-Tree */
55  bool bt_isleaf; /* Is this Leaf node? */
56  char bt_pad[7]; /* Used to padd */
57  struct be_btree_key_val bt_kv_arr[KV_NR]; /* Array of key-vals */
58  struct m0_be_bnode *bt_child_arr[KV_NR + 1]; /* childnode array */
59  struct m0_format_footer bt_footer; /* Footer of node */
60 } M0_XCA_RECORD M0_XCA_DOMAIN(be);
61 M0_BASSERT(sizeof(bool) == 1);
62 
65 
66  /* future versions, uncomment and update M0_BE_BNODE_FORMAT_VERSION */
67  /*M0_BE_BNODE_FORMAT_VERSION_2,*/
68  /*M0_BE_BNODE_FORMAT_VERSION_3,*/
69 
72 };
73 
75 #endif /* __MOTR_BE_BTREE_INTERNAL_H__ */
76 
77 /*
78  * Local variables:
79  * c-indentation-style: "K&R"
80  * c-basic-offset: 8
81  * tab-width: 8
82  * fill-column: 80
83  * scroll-step: 1
84  * End:
85  */
86 /*
87  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
88  */
enum m0_be_bnode_format_version M0_XCA_DOMAIN
struct be_btree_key_val bt_kv_arr[KV_NR]
struct m0_be_btree_backlink bt_backlink
M0_BASSERT(sizeof(bool)==1)
struct m0_be_bnode * bt_child_arr[KV_NR+1]
unsigned int bt_level
m0_be_bnode_format_version
struct m0_be_bnode * bt_next
char bt_pad[7]
unsigned int bt_num_active_key
struct m0_format_header bt_header
struct m0_format_footer bt_footer
static struct m0_be_ut_backend be
Definition: service_ut.c:59