32 for (
auto & entry : location_index) {
34 entry.spec.range, entry.state);
35 container.insert(copied);
43 auto iter = range_index.find(entry.
spec);
44 if (iter != range_index.end())
45 range_index.erase(iter);
46 container.insert(entry);
52 auto iter = range_index.find(qrs);
53 if (iter != range_index.end())
54 range_index.erase(iter);
61 for (
auto & entry : location_index) {
62 if (entry.location != last_location) {
63 last_location = entry.location;
64 locations.insert(last_location);
71 auto range_it = range_index.find(spec);
72 if (range_it != range_index.end()) {
73 location = range_it->location;
82 for (
auto & entry : index)
83 specs.push_back(entry.spec);
88 pair<ServerReceiverPlanLocationIndex::iterator, ServerReceiverPlanLocationIndex::iterator> bounds =
89 location_index.equal_range(location);
90 for (
auto iter = bounds.first; iter != bounds.second; ++iter)
91 specs.push_back(iter->spec);
95 vector<RangeState> &states)
const {
97 for (
auto & entry : index) {
98 specs.push_back(entry.spec);
99 states.push_back(entry.state);
105 vector<QualifiedRangeSpec> &specs,
106 vector<RangeState> &states)
const {
108 pair<ServerReceiverPlanLocationIndex::iterator, ServerReceiverPlanLocationIndex::iterator> bounds =
109 location_index.equal_range(location);
110 for (
auto iter = bounds.first; iter != bounds.second; ++iter) {
111 specs.push_back(iter->spec);
112 states.push_back(iter->state);
120 auto range_it = range_index.lower_bound(target);
124 while(range_it != range_index.end() && range_it->spec.table == table) {
125 if (strcmp(row, range_it->spec.range.start_row) > 0 &&
126 strcmp(row, range_it->spec.range.end_row) <= 0 ) {
127 spec = range_it->spec;
131 else if (strcmp(row, range_it->spec.range.start_row)<=0) {
154 for (
auto & entry : location_index) {
156 entry.spec.range, entry.state);
168 for (
auto & entry : location_index)
169 length += entry.encoded_length();
195 for (
auto & entry : location_index)
202 for (
size_t i = 0; i<count; ++i) {
204 tmp.
decode(bufp, remainp);
207 container.insert(entry);
std::set< String > StringSet
STL Set managing Strings.
uint8_t encoding_version() const override
Returns encoding version.
void copy(ReceiverPlan &other) const
std::string String
A String is simply a typedef to std::string.
void get_range_specs(vector< QualifiedRangeSpec > &specs) const
bool get_location(const QualifiedRangeSpec &spec, String &location) const
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
void get_range_specs_and_states(vector< QualifiedRangeSpec > &specs, vector< RangeState > &states) const
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
ServerReceiverPlanContainer container
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
size_t encoded_length_internal() const override
Returns internal serialized length.
virtual void decode(const uint8_t **bufp, size_t *remainp)
Reads serialized representation of object from a buffer.
void remove(const QualifiedRangeSpec &qrs)
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
void insert(const String &location, const TableIdentifier &table, const RangeSpec &range, const RangeState &state)
Qualified (with table identifier) range specification.
void get_locations(StringSet &locations) const
bool get_range_spec(const TableIdentifier &table, const char *row, QualifiedRangeSpec &spec) const
RangeServer recovery receiver plan.