position_in_partition: Introduce after_key()

This commit is contained in:
Tomasz Grabiec
2017-12-07 17:19:32 +01:00
parent 378f2ba8e4
commit bbd9ef6b59

View File

@@ -207,6 +207,10 @@ public:
position_in_partition(after_clustering_row_tag_t, clustering_key_prefix ck)
// FIXME: Use lexicographical_relation::before_strictly_prefixed here. Refs #1446
: _type(partition_region::clustered), _bound_weight(1), _ck(std::move(ck)) { }
position_in_partition(after_clustering_row_tag_t, position_in_partition_view pos)
: _type(partition_region::clustered)
, _bound_weight(pos._bound_weight ? pos._bound_weight : 1)
, _ck(*pos._ck) { }
position_in_partition(before_clustering_row_tag_t, clustering_key_prefix ck)
: _type(partition_region::clustered), _bound_weight(-1), _ck(std::move(ck)) { }
position_in_partition(range_tag_t, bound_view bv)
@@ -237,6 +241,13 @@ public:
return {after_clustering_row_tag_t(), std::move(ck)};
}
// If given position is a clustering row position, returns a position
// right after it. Otherwise returns it unchanged.
// The position "pos" must be a clustering position.
static position_in_partition after_key(position_in_partition_view pos) {
return {after_clustering_row_tag_t(), pos};
}
static position_in_partition for_key(clustering_key ck) {
return {clustering_row_tag_t(), std::move(ck)};
}