Skip to content

Commit f9b7146

Browse files
committed
Added non-void return types to address_table class for testability
1 parent 10333fa commit f9b7146

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

core/formats/columnstore2.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
////////////////////////////////////////////////////////////////////////////////
2222

2323
#pragma once
24-
2524
#include "formats/formats.hpp"
2625
#include "formats/sparse_bitmap.hpp"
2726
#include "resource_manager.hpp"
@@ -80,9 +79,10 @@ class column final : public irs::column_output {
8079
private:
8180
friend class writer;
8281

82+
public:
8383
class address_table {
8484
public:
85-
address_table(ManagedTypedAllocator<uint64_t> alloc) : alloc_{alloc} {
85+
address_table(ManagedTypedAllocator<uint64_t> alloc) : alloc_(alloc) {
8686
offsets_ = alloc_.allocate(kBlockSize);
8787
offset_ = offsets_;
8888
}
@@ -94,14 +94,22 @@ class column final : public irs::column_output {
9494
return offset_[-1];
9595
}
9696

97-
void push_back(uint64_t offset) noexcept {
97+
bool push_back(uint64_t offset) noexcept {
9898
IRS_ASSERT(offset_ < offsets_ + kBlockSize);
99+
if (!(offset_ < offsets_ + kBlockSize))
100+
return false;
101+
99102
*offset_++ = offset;
103+
return true;
100104
}
101105

102-
void pop_back() noexcept {
106+
bool pop_back() {
103107
IRS_ASSERT(offsets_ < offset_);
108+
if (!(offsets_ < offset_))
109+
return false;
110+
104111
--offset_;
112+
return true;
105113
}
106114

107115
uint32_t size() const noexcept {
@@ -124,6 +132,7 @@ class column final : public irs::column_output {
124132
uint64_t* offset_{nullptr};
125133
};
126134

135+
private:
127136
void Prepare(doc_id_t key) final;
128137

129138
bool empty() const noexcept { return addr_table_.empty() && !docs_count_; }

0 commit comments

Comments
 (0)