SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SystemColumn.cc
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 
9 
10 
11 namespace SWC { namespace DB { namespace Types { namespace SystemColumn {
12 
13 
14 
15 KeySeq get_seq_type(cid_t cid) noexcept {
16  switch(cid) {
17  case 2:
18  case 6:
19  return KeySeq::VOLUME;
20  case 3:
21  case 7:
22  return KeySeq::FC_LEXIC;
23  case 4:
24  case 8:
25  return KeySeq::FC_VOLUME;
26  default:
27  return KeySeq::LEXIC;
28  }
29 }
30 
31 
32 cid_t get_master_cid(KeySeq col_seq) noexcept {
33  switch(col_seq) {
34  case KeySeq::FC_VOLUME:
35  return 4;
36  case KeySeq::FC_LEXIC:
37  return 3;
38  case KeySeq::VOLUME:
39  return 2;
40  default:
41  return 1;
42  }
43 }
44 
45 cid_t get_meta_cid(KeySeq col_seq) noexcept {
46  switch(col_seq) {
47  case KeySeq::FC_VOLUME:
48  return 8;
49  case KeySeq::FC_LEXIC:
50  return 7;
51  case KeySeq::VOLUME:
52  return 6;
53  default:
54  return 5;
55  }
56 }
57 
58 const char* get_meta_cid_str(KeySeq col_seq) noexcept {
59  switch(col_seq) {
60  case KeySeq::FC_VOLUME:
61  return "8";
62  case KeySeq::FC_LEXIC:
63  return "7";
64  case KeySeq::VOLUME:
65  return "6";
66  default:
67  return "5";
68  }
69 }
70 
71 uint8_t get_sys_cid(KeySeq col_seq, Range col_type) noexcept {
72  switch(col_seq) {
73  case KeySeq::FC_VOLUME:
74  return col_type == Range::DATA ? 8 : 4;
75  case KeySeq::FC_LEXIC:
76  return col_type == Range::DATA ? 7 : 3;
77  case KeySeq::VOLUME:
78  return col_type == Range::DATA ? 6 : 2;
79  default:
80  return col_type == Range::DATA ? 5 : 1;
81  }
82 }
83 
84 }}}}
SWC::DB::Types::SystemColumn::get_meta_cid_str
const char *SWC_CONST_FUNC get_meta_cid_str(KeySeq col_seq) noexcept
Definition: SystemColumn.cc:58
SWC::DB::Types::SystemColumn::get_master_cid
cid_t SWC_CONST_FUNC get_master_cid(KeySeq col_seq) noexcept
Definition: SystemColumn.cc:32
SWC::DB::Types::KeySeq
KeySeq
Definition: KeySeq.h:13
SWC::DB::Types::KeySeq::UNKNOWN
@ UNKNOWN
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::DB::Types::Range::MASTER
@ MASTER
SWC::DB::Types::SystemColumn::get_sys_cid
uint8_t SWC_CONST_FUNC get_sys_cid(KeySeq col_seq, Range col_type) noexcept
Definition: SystemColumn.cc:71
SWC::DB::Types::SystemColumn::get_seq_type
KeySeq SWC_CONST_FUNC get_seq_type(cid_t cid) noexcept
Definition: SystemColumn.cc:15
SWC::cid_t
uint64_t cid_t
Definition: Identifiers.h:16
SWC::DB::Types::SystemColumn::get_meta_cid
cid_t SWC_CONST_FUNC get_meta_cid(KeySeq col_seq) noexcept
Definition: SystemColumn.cc:45
SWC::DB::Types::Range
Range
Definition: Range.h:14
SystemColumn.h