SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Mutable.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 
8 
9 
10 namespace SWC { namespace DB { namespace Cells {
11 
12 
13 void Mutable::configure(const uint32_t revs, const uint64_t ttl_ns,
14  const Types::Column typ, bool finalized) {
15  bool chk_revs = max_revs != revs && (!Types::is_counter(type) || finalized);
16  bool chk_ttl = ttl != ttl_ns;
17  type = typ;
18  ttl = ttl_ns;
19  max_revs = revs;
20  if(empty() || (!chk_revs && !chk_ttl))
21  return;
22  Cell* cell;
23  for(auto it = get<Iterator>(); it; ) {
24  if((cell = it.item())->has_expired(ttl)) {
25  _remove(it);
26  continue;
27  }
28  ++it;
29  if(chk_revs)
30  _remove_overhead(it, cell->key, 1);
31  }
32 }
33 
34 void Mutable::write_and_free(DynamicBuffer& cells, uint32_t& cell_count,
35  Interval& intval, uint32_t threshold,
36  uint32_t max_cells) {
37  if(!_size)
38  return;
39 
40  cells.ensure(_bytes < threshold? _bytes: threshold);
41  Cell* first = nullptr;
42  Cell* last = nullptr;
43  Cell* cell;
44  size_t count = 0;
45  Iterator it_start = get<Iterator>();
46  for(auto it=it_start; it && (!threshold || threshold > cells.fill()) &&
47  (!max_cells || max_cells > cell_count); ++it) {
48  ++count;
49  if((cell=it.item())->has_expired(ttl))
50  continue;
51 
52  cell->write(cells);
53  intval.expand(cell->get_timestamp());
54  intval.align(cell->key);
55  (first ? last : first) = cell;
56  ++cell_count;
57  }
58 
59  if(first) {
60  intval.expand_begin(*first);
61  intval.expand_end(*(last ? last : first));
62  }
63 
64  if(_size == count)
65  free();
66  else if(count)
67  _remove(it_start, count);
68 }
69 
70 bool Mutable::write_and_free(const DB::Cell::Key& key_start,
71  const DB::Cell::Key& key_finish,
72  DynamicBuffer& cells, uint32_t threshold) {
73  bool more = _size;
74  if(!more)
75  return more;
76 
77  cells.ensure(_bytes < threshold? _bytes: threshold);
78 
79  size_t count = 0;
80  Iterator it_start = get<Iterator>();
81  {
82  Iterator it = get<Iterator>(key_start);
83  for(Cell* cell; it && (!threshold || threshold > cells.fill()); ++it) {
84  cell = it.item();
85 
86  if(!key_start.empty() &&
87  DB::KeySeq::compare(key_seq, key_start, cell->key) == Condition::LT)
88  continue;
89  if(!key_finish.empty() &&
90  DB::KeySeq::compare(key_seq, key_finish, cell->key) == Condition::GT) {
91  more = false;
92  break;
93  }
94 
95  if(!count)
96  it_start = it;
97  ++count;
98 
99  if(!cell->has_expired(ttl))
100  cell->write(cells);
101  }
102  }
103 
104  if(count) {
105  if(count == _size) {
106  free();
107  } else {
108  _remove(it_start, count);
109  return more && it_start;
110  }
111  }
112  return false;
113 }
114 
115 bool Mutable::write_and_free(DynamicBuffer& cells, uint32_t threshold) {
116  bool more = _size;
117  if(!more)
118  return more;
119 
120  cells.ensure(_bytes < threshold? _bytes: threshold);
121 
122  size_t count = 0;
123  Iterator it_start = get<Iterator>();
124  for(auto it=it_start; it && (!threshold || threshold>cells.fill()); ++it) {
125  ++count;
126  if(!it.item()->has_expired(ttl))
127  it.item()->write(cells);
128  }
129  if(count) {
130  if(count == _size) {
131  free();
132  } else {
133  _remove(it_start, count);
134  return it_start;
135  }
136  }
137  return false;
138 }
139 
140 void Mutable::print(std::ostream& out, bool with_cells) const {
141  out << "Cells(size=" << _size
142  << " bytes=" << _bytes
143  << " type=" << Types::to_string(type)
144  << " max_revs=" << max_revs
145  << " ttl=" << ttl
146  << " sizeof-container=" << _container.size_of_internal();
147  if(with_cells) {
148  size_t count = 0;
149  out << " [\n";
150  for(auto it = get<ConstIterator>(); it; ++it) {
151  it.item()->print(out << '\n', type);
152  ++count;
153  }
154  out << "] counted=" << count;
155  _container.print(out << "\n container=");
156  }
157 
158  out << ')';
159 }
160 
161 
163  bool stop = false;
164  const bool only_deletes = req->spec.flags.is_only_deletes();
165  const Cell* cell;
166  for(auto it = get<ConstIterator>(req->spec); !stop && it; ++it) {
167  cell = it.item();
168 
169  if((only_deletes ? cell->flag == INSERT : cell->flag != INSERT) ||
170  cell->has_expired(ttl) ||
171  !req->selector(key_seq, *cell, stop) ||
172  req->offset_adjusted()) {
173  req->profile.skip_cell();
174 
175  } else if(!req->add_cell_and_more(*cell)) {
176  break;
177  }
178  }
179 }
180 
182  bool stop = false;
183  const bool only_deletes = req->spec.flags.is_only_deletes();
184 
185  bool chk_align = !req->spec.offset_key.empty();
186  uint32_t rev = chk_align ? req->spec.flags.max_versions : 0;
187  const DB::Cell::Key* last_key = nullptr;
188  const Cell* cell;
189  for(auto it = get<ConstIterator>(req->spec); !stop && it; ++it) {
190  cell = it.item();
191 
192  if((only_deletes ? cell->flag == INSERT : cell->flag != INSERT) ||
193  cell->has_expired(ttl)) {
194  req->profile.skip_cell();
195  continue;
196  }
197 
198  if(chk_align) {
199  switch(DB::KeySeq::compare(key_seq, req->spec.offset_key, cell->key)) {
200  case Condition::LT: {
201  req->profile.skip_cell();
202  continue;
203  }
204  case Condition::EQ: {
205  if(!req->spec.is_matching(
206  cell->get_timestamp(), cell->is_time_order_desc())) {
207  if(!--rev)
208  chk_align = false;
209  last_key = &cell->key;
210  req->profile.skip_cell();
211  continue;
212  }
213  [[fallthrough]];
214  }
215  default:
216  chk_align = false;
217  }
218  }
219 
220  if(!req->selector(key_seq, *cell, stop)) {
221  req->profile.skip_cell();
222  continue;
223  }
224  if(last_key && last_key->equal(cell->key)) {
225  if(!rev) {
226  req->profile.skip_cell();
227  continue;
228  }
229  } else {
230  rev = req->spec.flags.max_versions;
231  last_key = &cell->key;
232  }
233 
234  if(req->offset_adjusted()) {
235  --rev;
236  req->profile.skip_cell();
237  continue;
238  }
239 
240  if(!req->add_cell_and_more(*cell))
241  break;
242  --rev;
243  }
244 }
245 
247  DynamicBuffer& result,
248  size_t& count, size_t& skips) const {
249  //std::cout << "## scan_test_use" << std::endl;
250  bool stop = false;
251  uint32_t cell_offset = specs.flags.offset;
252  const bool only_deletes = specs.flags.is_only_deletes();
253  const Cell* cell;
254  for(auto it = get<ConstIterator>(); !stop && it; ++it) {
255  cell = it.item();
256  //cell->print(std::cout << "\n scan_test_use ", DB::Types::Column::PLAIN);
257 
258  if((only_deletes ? cell->flag != INSERT : cell->flag == INSERT) &&
259  !cell->has_expired(ttl) &&
260  specs.is_matching(key_seq, *cell, stop)) {
261 
262  if(cell_offset) {
263  --cell_offset;
264  ++skips;
265  continue;
266  }
267 
268  cell->write(result);
269  if(++count == specs.flags.limit)
270  // specs.flags.limit_by && specs.flags.max_versions
271  break;
272  } else {
273  ++skips;
274  }
275  }
276 }
277 
278 
280  size_t& offset) {
281  for(Cell* cell; it; ) {
282  if((cell = it.item())->has_expired(ttl)) {
283  _remove(it);
284  continue;
285  }
286  switch(DB::KeySeq::compare(key_seq, cell->key, e_cell.key)) {
287  case Condition::GT: {
288  ++it;
289  ++offset;
290  break;
291  }
292  case Condition::LT: {
293  _insert(it, e_cell);
294  return;
295  }
296  default: {
297  bool chk_rev = e_cell.get_revision() != TIMESTAMP_AUTO;
298  bool rev_set = cell->get_revision() != TIMESTAMP_AUTO;
299  if(chk_rev && (
300  cell->get_revision() == e_cell.get_revision()
301  ||
302  (cell->removal() &&
303  (!rev_set || cell->get_revision() > e_cell.get_revision()) &&
304  cell->is_removing(e_cell.get_timestamp())) ) ) {
305  return;
306  }
307  if((!chk_rev ||
308  (rev_set && e_cell.get_revision() > cell->get_revision())
309  ) && e_cell.is_removing(cell->get_timestamp()) ) {
310  _remove(it);
311  } else {
312  ++it;
313  }
314  break;
315  }
316  }
317  }
318  add_sorted(e_cell);
319 }
320 
321 void Mutable::_add_unfinalized(const Cell& e_cell,
322  Mutable::Iterator& it,
323  size_t& offset) {
324  for(Cell* cell; it; ) {
325  if((cell = it.item())->has_expired(ttl)) {
326  _remove(it);
327  continue;
328  }
329  switch(DB::KeySeq::compare(key_seq, cell->key, e_cell.key)) {
330  case Condition::GT: {
331  ++it;
332  ++offset;
333  break;
334  }
335  case Condition::LT: {
336  _insert(it, e_cell);
337  return;
338  }
339  default: {
340  if(e_cell.get_revision() == TIMESTAMP_AUTO) {
341  ++it;
342  break;
343  }
344  if(cell->get_revision() != TIMESTAMP_AUTO) {
345  if(cell->get_revision() == e_cell.get_revision()) {
346  return;
347  }
348  if(e_cell.get_revision() > cell->get_revision()) {
349  ++it;
350  break;
351  }
352  if(cell->removal() && cell->is_removing(e_cell.get_timestamp())) {
353  return;
354  }
355  }
356  _insert(it, e_cell);
357  return;
358  }
359  }
360  }
361 
362  add_sorted(e_cell);
363 }
364 
365 
367  Mutable::Iterator& it,
368  size_t& offset) {
369  for(Cell* cell; it; ) {
370  if((cell = it.item())->has_expired(ttl)) {
371  _remove(it);
372  continue;
373  }
374  switch(DB::KeySeq::compare(key_seq, cell->key, e_cell.key)) {
375  case Condition::GT: {
376  ++it;
377  ++offset;
378  break;;
379  }
380  case Condition::LT: {
381  _insert(it, e_cell);
382  return;
383  }
384  default: {
385  bool chk_rev = e_cell.get_revision() != TIMESTAMP_AUTO;
386  if(cell->removal()) {
387  if(chk_rev &&
388  cell->get_revision() > e_cell.get_revision() &&
389  cell->is_removing(e_cell.get_timestamp()) )
390  return;
391  ++it;
392  break;
393  }
394  if(!chk_rev || e_cell.get_revision() > cell->get_revision()) {
395  _adjust_copy(*cell, e_cell);
396  }
397  return;
398  }
399  }
400  }
401  add_sorted(e_cell);
402 }
403 
405  Mutable::Iterator& it,
406  size_t& offset) {
407  bool chk_ts = e_cell.get_timestamp() != TIMESTAMP_AUTO;
408  bool chk_rev = e_cell.get_revision() != TIMESTAMP_AUTO;
409  uint32_t revs = 0;
410 
411  for(Cell* cell; it; ) {
412  if((cell = it.item())->has_expired(ttl)) {
413  _remove(it);
414  continue;
415  }
416  switch(DB::KeySeq::compare(key_seq, cell->key, e_cell.key)) {
417  case Condition::GT: {
418  ++it;
419  ++offset;
420  continue;
421  }
422  case Condition::LT: {
423  _insert(it, e_cell);
424  return;
425  }
426  default: {
427  break;
428  }
429  }
430 
431  if(chk_rev && cell->get_revision() == e_cell.get_revision())
432  return;
433 
434  if(cell->removal()) {
435  if(chk_rev &&
436  cell->get_revision() > e_cell.get_revision() &&
437  cell->is_removing(e_cell.get_timestamp()) )
438  return;
439  ++it;
440  continue;
441  }
442 
443  if(chk_ts && cell->get_timestamp() == e_cell.get_timestamp()) {
444  if(!chk_rev || e_cell.get_revision() > cell->get_revision())
445  _adjust_copy(*cell, e_cell);
446  return;
447  }
448 
449  ++revs;
450  if(e_cell.is_time_order_desc()
451  ? (chk_ts && e_cell.get_timestamp() < cell->get_timestamp())
452  : (!chk_ts || e_cell.get_timestamp() > cell->get_timestamp()) ) {
453  if(max_revs == revs)
454  return;
455  ++it;
456  continue;
457  }
458 
459  if(max_revs == revs) {
460  if(!chk_rev || e_cell.get_revision() > cell->get_revision())
461  _adjust_copy(*cell, e_cell);
462  } else {
463  _insert(it, e_cell);
464  ++it;
465  _remove_overhead(it, e_cell.key, revs);
466  }
467  return;
468  }
469 
470  add_sorted(e_cell);
471 }
472 
474  size_t& offset) {
475  for(Cell* cell; it; ) {
476  if((cell = it.item())->has_expired(ttl)) {
477  _remove(it);
478  continue;
479  }
480  switch(DB::KeySeq::compare(key_seq, cell->key, e_cell.key)) {
481  case Condition::GT: {
482  ++it;
483  ++offset;
484  break;
485  }
486  case Condition::LT: {
487  goto add_counter;
488  }
489  default: {
490  if(cell->removal()) {
491  if(e_cell.get_revision() != TIMESTAMP_AUTO &&
492  cell->get_revision() > e_cell.get_revision() &&
493  cell->is_removing(e_cell.get_timestamp()) )
494  return;
495  ++it;
496  break;
497  }
498 
499  uint8_t op;
500  int64_t eq_rev;
501  int64_t value = cell->get_counter(op, eq_rev);
502  if(op & OP_EQUAL) {
503  if(eq_rev == TIMESTAMP_NULL &&
504  cell->get_timestamp() != TIMESTAMP_AUTO) {
505  eq_rev = cell->get_timestamp();
506  }
507  if(eq_rev > e_cell.get_timestamp())
508  return;
509  }
510 
511  int64_t value_2;
512  if(e_cell.get_counter(value_2) & OP_EQUAL) {
513  _adjust_copy(*cell, e_cell);
514  } else {
515  _bytes -= cell->encoded_length();
516  value += value_2;
517  cell->set_counter(op, value, type, eq_rev);
518  int64_t ts = (e_cell.get_timestamp() == TIMESTAMP_AUTO ||
519  e_cell.get_timestamp() > cell->get_timestamp())
520  ? e_cell.get_timestamp() : cell->get_timestamp();
521  int64_t rev =(e_cell.get_revision() == TIMESTAMP_AUTO ||
522  e_cell.get_revision() > cell->get_revision())
523  ? e_cell.get_revision() : cell->get_revision();
524  if(ts == TIMESTAMP_AUTO) {
525  cell->set_timestamp_auto();
526  if(rev != TIMESTAMP_AUTO)
527  cell->set_revision(rev);
528  } else if(ts == rev) {
529  cell->set_timestamp_with_rev_is_ts(ts);
530  } else {
531  cell->set_timestamp(ts);
532  cell->set_revision(rev);
533  }
534  _bytes += cell->encoded_length();
535  }
536  return;
537  }
538  }
539  }
540 
541  add_counter: {
542  bool no_value = type != Types::Column::COUNTER_I64;
543  Cell* cell = new Cell(e_cell, no_value);
544  if(no_value) {
545  uint8_t op;
546  int64_t eq_rev;
547  int64_t value = e_cell.get_counter(op, eq_rev);
548  cell->set_counter(op, value, type, eq_rev);
549  }
550  _add(*cell);
551  it ? it.insert(cell) : _container.push_back(cell);
552  }
553 }
554 
555 
557  Mutable finalized_cells(key_seq, max_revs, ttl, type);
558  Iterator it = get<Iterator>();
559  Iterator agg_it(it);
560  Cell* agg = nullptr;
561  bool agg_state = false;
562  int64_t agg_rev = 0;
563  int64_t agg_ts = 0;
564  uint8_t agg_op = 0;
565  int64_t agg_eq_rev = 0;
566  int64_t agg_value = 0;
567  for(Cell* cell; ;) {
568 
569  if(!agg || agg_it == it) {
570  for(; agg_it &&
571  ((agg = agg_it.item())->has_expired(ttl) || agg->removal());
572  ++agg_it);
573  if(!agg_it)
574  break;
575  agg_state = false;
576  ++(it = agg_it);
577  }
578 
579  if(!it || !agg->key.equal((cell = it.item())->key)) {
580  Cell* agged = new Cell(*agg, agg_state);
581  if(agg_state) {
582  if(agg_ts == agg_rev) {
583  agged->set_timestamp_with_rev_is_ts(agg_ts);
584  } else {
585  agged->set_timestamp(agg_ts);
586  agged->set_revision(agg_rev);
587  }
588  agged->set_counter(OP_EQUAL, agg_value, type, TIMESTAMP_NULL);
589  }
590  finalized_cells.add_sorted(agged);
591 
592  if(!it)
593  break;
594  agg_it = it;
595  continue;
596  }
597 
598  if(!cell->has_expired(ttl) && !cell->removal()) {
599  if(!agg_state) {
600  agg_rev = agg->get_revision();
601  agg_ts = agg->get_timestamp();
602  agg_value = agg->get_counter(agg_op, agg_eq_rev);
603  if(agg_eq_rev == TIMESTAMP_NULL)
604  agg_eq_rev = agg_ts;
605  agg_state = true;
606  }
607  uint8_t op;
608  int64_t eq_rev;
609  int64_t value = cell->get_counter(op, eq_rev);
610  if(eq_rev == TIMESTAMP_NULL)
611  eq_rev = cell->get_timestamp();
612 
613  if(!(agg_op & OP_EQUAL) || eq_rev >= agg_eq_rev) {
614  if(op & OP_EQUAL) {
615  agg_op = op;
616  agg_value = value;
617  agg_eq_rev = eq_rev;
618  } else {
619  agg_value += value;
620  }
621  if(agg_ts < cell->get_timestamp())
622  agg_ts = cell->get_timestamp();
623  agg_rev = cell->get_revision();
624  }
625  }
626  ++it;
627  }
628 
629  *this = std::move(finalized_cells);
630 }
631 
632 
633 /* without temp "finalized_cells", remove from and keep the _container
634 void Mutable::_finalize_counter() {
635  Iterator it = get<Iterator>();
636  Iterator agg_it(it);
637  Cell* agg = nullptr;
638  int64_t agg_rev;
639  int64_t agg_ts;
640  uint8_t agg_op;
641  int64_t agg_eq_rev;
642  int64_t agg_value;
643  Cell* cell;
644  for(size_t revs = 1; ;) {
645 
646  if(!agg || agg_it == it) {
647  while((agg = agg_it.item())->has_expired(ttl) || agg->removal()) {
648  _remove(agg_it);
649  if(!agg_it)
650  return;
651  }
652  agg_rev = agg->get_revision();
653  agg_ts = agg->get_timestamp();
654  agg_value = agg->get_counter(agg_op, agg_eq_rev);
655  if(agg_eq_rev == TIMESTAMP_NULL)
656  agg_eq_rev = agg_ts;
657  ++(it = agg_it);
658  }
659 
660  if(!it || !agg->key.equal((cell = it.item())->key)) {
661  ++agg_it;
662  if(revs > 1) {
663  if(agg_ts == agg_rev) {
664  agg->set_timestamp_with_rev_is_ts(agg_ts);
665  } else {
666  agged->set_timestamp(agg_ts);
667  agged->set_revision(agg_rev);
668  }
669  _remove(agg_it, --revs);
670  revs = 1;
671  }
672  agged->set_counter(OP_EQUAL, agg_value, type, TIMESTAMP_NULL);
673  if(!agg_it)
674  return;
675  it = agg_it;
676  continue;
677  }
678 
679  if(!cell->has_expired(ttl) && !cell->removal()) {
680  uint8_t op;
681  int64_t eq_rev;
682  int64_t value = cell->get_counter(op, eq_rev);
683  if(eq_rev == TIMESTAMP_NULL)
684  eq_rev = cell->get_timestamp();
685 
686  if(!(agg_op & OP_EQUAL) || eq_rev > agg_eq_rev) {
687  if(op & OP_EQUAL) {
688  agg_op = op;
689  agg_value = value;
690  agg_eq_rev = eq_rev;
691  } else {
692  agg_value += value;
693  }
694  agg_ts = cell->get_timestamp();
695  agg_rev = cell->get_revision();
696  }
697  }
698  ++revs;
699  ++it;
700  }
701 }
702 */
703 
704 
705 
706 
707 }}}
SWC::DB::Cells::Cell::set_counter
void set_counter(uint8_t op, int64_t v, Types::Column typ=Types::Column::COUNTER_I64, int64_t rev=TIMESTAMP_NULL)
Definition: Cell.h:450
SWC::DB::Cells::ReqScan::offset_adjusted
SWC_CAN_INLINE bool offset_adjusted() noexcept
Definition: ReqScan.h:83
SWC::DB::Cells::Mutable::scan_test_use
void scan_test_use(const Specs::Interval &specs, DynamicBuffer &result, size_t &count, size_t &skips) const
Definition: Mutable.cc:246
SWC::DB::Specs::Flags::max_versions
uint32_t max_versions
Definition: SpecsFlags.h:143
SWC::DB::Cells::Mutable::write_and_free
void write_and_free(DynamicBuffer &cells, uint32_t &cell_count, Interval &intval, uint32_t threshold, uint32_t max_cells)
Definition: Mutable.cc:34
SWC::DB::Cells::Interval::align
SWC_CAN_INLINE bool align(const Interval &other)
Definition: Interval.h:152
SWC::Condition::GT
@ GT
Definition: Comparators.h:30
SWC::DB::Cells::Mutable::configure
void configure(const uint32_t revs, const uint64_t ttl_ns, const Types::Column typ, bool finalized)
Definition: Mutable.cc:13
SWC::DB::Cells::Interval::expand_end
SWC_CAN_INLINE void expand_end(const Cell &cell)
Definition: Interval.h:136
SWC::DB::Cells::Mutable::_bytes
size_t _bytes
Definition: Mutable.h:59
SWC::DB::Types::to_string
const char *SWC_CONST_FUNC to_string(Column typ) noexcept
Definition: Column.cc:38
SWC::DB::Cells::Mutable::scan_version_single
void scan_version_single(ReqScan *req) const
Definition: Mutable.cc:162
SWC::DB::Specs::Flags::offset
uint64_t offset
Definition: SpecsFlags.h:142
SWC::Core::BufferDyn::ensure
SWC_CAN_INLINE void ensure(size_t len)
Definition: Buffer.h:212
SWC::DB::Types::Column
Column
Definition: Column.h:18
SWC::DB::Cell::Key::equal
constexpr SWC_CAN_INLINE bool equal(const Key &other) const noexcept
Definition: CellKey.h:179
SWC::Condition::LT
@ LT
Definition: Comparators.h:34
SWC::DB::Cells::TIMESTAMP_AUTO
constexpr const int64_t TIMESTAMP_AUTO
Definition: Cell.h:73
SWC::DB::Cells::Mutable::scan_version_multi
void scan_version_multi(ReqScan *req) const
Definition: Mutable.cc:181
SWC::DB::Cells::Interval::expand
void expand(const Interval &other)
Definition: Interval.cc:38
SWC::DB::Cells::Cell::is_removing
constexpr SWC_CAN_INLINE bool is_removing(const int64_t &ts) const noexcept
Definition: Cell.h:308
SWC::DB::Cells::Cell
Definition: Cell.h:92
SWC::DB::Cells::ReqScan::add_cell_and_more
virtual bool add_cell_and_more(const Cell &cell)=0
SWC::DB::Cell::Key
Definition: CellKey.h:24
SWC::DB::Cells::Mutable::_finalize_counter
void _finalize_counter()
Definition: Mutable.cc:556
SWC::DB::Cells::Cell::key
DB::Cell::Key key
Definition: Cell.h:357
SWC::DB::Specs::Flags::is_only_deletes
constexpr SWC_CAN_INLINE bool is_only_deletes() const noexcept
Definition: SpecsFlags.h:70
SWC::DB::Cells::Mutable::_remove_overhead
SWC_CAN_INLINE void _remove_overhead(Iterator &it, const DB::Cell::Key &key, uint32_t revs)
Definition: Mutable.h:728
SWC::DB::Cells::Cell::has_expired
SWC_CAN_INLINE bool has_expired(const int64_t ttl) const noexcept
Definition: Cell.h:327
SWC::DB::Cells::ReqScan::profile
Profile profile
Definition: ReqScan.h:194
SWC::DB::Cells::Cell::set_revision
constexpr SWC_CAN_INLINE void set_revision(int64_t ts) noexcept
Definition: Cell.h:216
SWC::DB::Cells::Mutable::add_sorted
SWC_CAN_INLINE void add_sorted(const Cell &cell, bool no_value=false)
Definition: Mutable.h:413
SWC::DB::Cells::ReqScan::selector
virtual bool selector(const Types::KeySeq key_seq, const Cell &cell, bool &stop)
Definition: ReqScan.cc:13
SWC::DB::Cells::Mutable::_adjust_copy
SWC_CAN_INLINE void _adjust_copy(Cell &cell, const Cell &other)
Definition: Mutable.h:695
SWC::DB::Cell::Key::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: CellKey.h:186
SWC::DB::Cells::Mutable::_size
size_t _size
Definition: Mutable.h:60
SWC::DB::Cells::Cell::is_time_order_desc
constexpr SWC_CAN_INLINE bool is_time_order_desc() const noexcept
Definition: Cell.h:177
SWC::DB::Cells::ReqScan
Definition: ReqScan.h:19
SWC::DB::Cells::ReqScan::Profile::skip_cell
SWC_CAN_INLINE void skip_cell() noexcept
Definition: ReqScan.h:141
SWC::Core::VectorsVector::size_of_internal
constexpr SWC_CAN_INLINE size_t size_of_internal() const noexcept
Definition: VectorsVector.h:592
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::DB::Cells::Mutable::free
SWC_CAN_INLINE void free() noexcept
Definition: Mutable.h:157
SWC::DB::Types::is_counter
bool SWC_CONST_FUNC is_counter(const Column typ) noexcept
Definition: Column.cc:26
SWC::Core::BufferDyn< StaticBuffer >
SWC::DB::Cells::Mutable::_add_plain_version_single
void _add_plain_version_single(const Cell &e_cell, Iterator &it, size_t &offset)
Definition: Mutable.cc:366
SWC::Condition::EQ
@ EQ
Definition: Comparators.h:32
SWC::DB::Cells::Cell::set_timestamp_with_rev_is_ts
constexpr SWC_CAN_INLINE void set_timestamp_with_rev_is_ts(int64_t ts) noexcept
Definition: Cell.h:208
SWC::DB::Cells::Mutable::_add_unfinalized
void _add_unfinalized(const Cell &e_cell, Iterator &it, size_t &offset)
Definition: Mutable.cc:321
SWC::DB::Cells::INSERT
@ INSERT
Definition: Cell.h:62
SWC::Core::VectorsVector::push_back
SWC_CAN_INLINE void push_back(const value_type &value)
Definition: VectorsVector.h:646
SWC::DB::Cells::Mutable::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Mutable.h:185
SWC::DB::Cells::Mutable::_add_plain_version_multi
void _add_plain_version_multi(const Cell &e_cell, Iterator &it, size_t &offset)
Definition: Mutable.cc:404
SWC::DB::Cells::Mutable::_remove
constexpr SWC_CAN_INLINE void _remove(const Cell &cell) noexcept
Definition: Mutable.h:689
SWC::DB::Cells::TIMESTAMP_NULL
constexpr const int64_t TIMESTAMP_NULL
Definition: Cell.h:72
SWC::DB::Specs::Interval::flags
Flags flags
Definition: SpecsInterval.h:242
SWC::Core::VectorsVector::print
void print(std::ostream &out) const
Definition: VectorsVector.h:676
SWC::DB::Cells::Mutable::ttl
uint64_t ttl
Definition: Mutable.h:74
SWC::DB::Cells::Mutable::print
void print(std::ostream &out, bool with_cells=false) const
Definition: Mutable.cc:140
SWC::DB::Cells::ReqScan::spec
DB::Specs::Interval spec
Definition: ReqScan.h:106
SWC::DB::Cells::Mutable::key_seq
const Types::KeySeq key_seq
Definition: Mutable.h:71
SWC::DB::Cells::Mutable::_container
Container _container
Definition: Mutable.h:58
SWC::DB::Cells::Cell::write
void write(DynamicBuffer &dst_buf, bool no_value=false) const
Definition: Cell.h:513
SWC::Core::BufferDyn::fill
constexpr SWC_CAN_INLINE size_t fill() const noexcept
Definition: Buffer.h:192
SWC::DB::Specs::Interval
Definition: SpecsInterval.h:25
SWC::DB::Cells::Interval::expand_begin
SWC_CAN_INLINE void expand_begin(const Cell &cell)
Definition: Interval.h:129
SWC::DB::Cells::Mutable::type
Types::Column type
Definition: Mutable.h:72
SWC::DB::Cells::Cell::get_timestamp
constexpr SWC_CAN_INLINE int64_t get_timestamp() const noexcept
Definition: Cell.h:317
SWC::DB::Cells::OP_EQUAL
constexpr const uint8_t OP_EQUAL
Definition: Cell.h:83
SWC::DB::Cells::Cell::get_counter
constexpr SWC_CAN_INLINE int64_t get_counter() const
Definition: Cell.h:260
SWC::DB::Cells::Mutable::_insert
SWC_CAN_INLINE void _insert(Iterator &it, const Cell &cell)
Definition: Mutable.h:702
SWC::DB::Specs::Interval::offset_key
Cell::Key offset_key
Definition: SpecsInterval.h:244
SWC::DB::Cells::Mutable::Iterator
Container::Iterator Iterator
Definition: Mutable.h:68
SWC::DB::Cells::Mutable::_add_remove
void _add_remove(const Cell &e_cell, Iterator &it, size_t &offset)
Definition: Mutable.cc:279
SWC::DB::Cells::Interval
Definition: Interval.h:17
SWC::DB::Specs::Flags::limit
uint64_t limit
Definition: SpecsFlags.h:142
SWC::DB::Cells::Mutable::_add
constexpr SWC_CAN_INLINE void _add(const Cell &cell) noexcept
Definition: Mutable.h:683
SWC::DB::Specs::Interval::is_matching
SWC_CAN_INLINE bool is_matching(const Types::KeySeq key_seq, const Cell::Key &key, int64_t timestamp, bool desc) const
Definition: SpecsInterval.h:91
SWC::DB::Cells::Mutable
Definition: Mutable.h:21
SWC::DB::Cells::Mutable::_add_counter
void _add_counter(const Cell &e_cell, Iterator &it, size_t &offset)
Definition: Mutable.cc:473
SWC::DB::Cells::Cell::flag
uint8_t flag
Definition: Cell.h:359
SWC::DB::KeySeq::compare
Condition::Comp compare(const Types::KeySeq seq, const Cell::Key &key, const Cell::Key &other) SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: KeyComparator.h:294
SWC::DB::Cells::Cell::get_revision
constexpr SWC_CAN_INLINE int64_t get_revision() const noexcept
Definition: Cell.h:322
SWC::DB::Cells::Mutable::max_revs
uint32_t max_revs
Definition: Mutable.h:73
Mutable.h
SWC::DB::Cells::Cell::set_timestamp
constexpr SWC_CAN_INLINE void set_timestamp(int64_t ts) noexcept
Definition: Cell.h:182