10 namespace SWC {
namespace DB {
namespace Cells {
16 bool chk_ttl =
ttl != ttl_ns;
20 if(
empty() || (!chk_revs && !chk_ttl))
23 for(
auto it = get<Iterator>(); it; ) {
24 if((cell = it.item())->has_expired(
ttl)) {
35 Interval& intval, uint32_t threshold,
41 Cell* first =
nullptr;
46 for(
auto it=it_start; it && (!threshold || threshold > cells.
fill()) &&
47 (!max_cells || max_cells > cell_count); ++it) {
49 if((cell=it.item())->has_expired(
ttl))
55 (first ? last : first) = cell;
82 Iterator it = get<Iterator>(key_start);
83 for(
Cell* cell; it && (!threshold || threshold > cells.
fill()); ++it) {
86 if(!key_start.
empty() &&
89 if(!key_finish.
empty() &&
99 if(!cell->has_expired(
ttl))
109 return more && it_start;
123 Iterator it_start = get<Iterator>();
124 for(
auto it=it_start; it && (!threshold || threshold>cells.
fill()); ++it) {
126 if(!it.item()->has_expired(
ttl))
127 it.item()->write(cells);
141 out <<
"Cells(size=" <<
_size
150 for(
auto it = get<ConstIterator>(); it; ++it) {
151 it.item()->print(out <<
'\n',
type);
154 out <<
"] counted=" << count;
166 for(
auto it = get<ConstIterator>(req->
spec); !stop && it; ++it) {
189 for(
auto it = get<ConstIterator>(req->
spec); !stop && it; ++it) {
209 last_key = &cell->
key;
224 if(last_key && last_key->
equal(cell->
key)) {
231 last_key = &cell->
key;
248 size_t& count,
size_t& skips)
const {
254 for(
auto it = get<ConstIterator>(); !stop && it; ++it) {
281 for(
Cell* cell; it; ) {
282 if((cell = it.item())->has_expired(
ttl)) {
303 (!rev_set || cell->get_revision() > e_cell.
get_revision()) &&
308 (rev_set && e_cell.
get_revision() > cell->get_revision())
324 for(
Cell* cell; it; ) {
325 if((cell = it.item())->has_expired(
ttl)) {
352 if(cell->removal() && cell->is_removing(e_cell.
get_timestamp())) {
369 for(
Cell* cell; it; ) {
370 if((cell = it.item())->has_expired(
ttl)) {
386 if(cell->removal()) {
394 if(!chk_rev || e_cell.
get_revision() > cell->get_revision()) {
411 for(
Cell* cell; it; ) {
412 if((cell = it.item())->has_expired(
ttl)) {
431 if(chk_rev && cell->get_revision() == e_cell.
get_revision())
434 if(cell->removal()) {
443 if(chk_ts && cell->get_timestamp() == e_cell.
get_timestamp()) {
444 if(!chk_rev || e_cell.
get_revision() > cell->get_revision())
452 : (!chk_ts || e_cell.
get_timestamp() > cell->get_timestamp()) ) {
460 if(!chk_rev || e_cell.
get_revision() > cell->get_revision())
475 for(
Cell* cell; it; ) {
476 if((cell = it.item())->has_expired(
ttl)) {
490 if(cell->removal()) {
501 int64_t value = cell->get_counter(op, eq_rev);
505 eq_rev = cell->get_timestamp();
515 _bytes -= cell->encoded_length();
517 cell->set_counter(op, value,
type, eq_rev);
525 cell->set_timestamp_auto();
527 cell->set_revision(rev);
528 }
else if(ts == rev) {
529 cell->set_timestamp_with_rev_is_ts(ts);
531 cell->set_timestamp(ts);
532 cell->set_revision(rev);
534 _bytes += cell->encoded_length();
542 bool no_value =
type != Types::Column::COUNTER_I64;
543 Cell* cell =
new Cell(e_cell, no_value);
561 bool agg_state =
false;
565 int64_t agg_eq_rev = 0;
566 int64_t agg_value = 0;
569 if(!agg || agg_it == it) {
571 ((agg = agg_it.item())->has_expired(
ttl) || agg->removal());
579 if(!it || !agg->
key.
equal((cell = it.item())->key)) {
580 Cell* agged =
new Cell(*agg, agg_state);
582 if(agg_ts == agg_rev) {
598 if(!cell->has_expired(
ttl) && !cell->removal()) {
609 int64_t value = cell->get_counter(op, eq_rev);
611 eq_rev = cell->get_timestamp();
613 if(!(agg_op &
OP_EQUAL) || eq_rev >= agg_eq_rev) {
621 if(agg_ts < cell->get_timestamp())
622 agg_ts = cell->get_timestamp();
623 agg_rev = cell->get_revision();
629 *
this = std::move(finalized_cells);