Skip to content

Commit

Permalink
mutation_partition: Introduce apply_insert()
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrabiec committed May 8, 2015
1 parent 84d2b2b commit 386d17d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mutation_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ mutation_partition::apply_delete(schema_ptr schema, clustering_key_view key, tom
clustered_row(*schema, key).apply(t);
}

void
mutation_partition::apply_insert(const schema& s, clustering_key_view key, api::timestamp_type created_at) {
clustered_row(s, key).apply(created_at);
}

const rows_entry*
mutation_partition::find_entry(schema_ptr schema, const clustering_key_prefix& key) const {
auto i = _rows.find(key, rows_entry::key_comparator(clustering_key::less_compare_with_prefix(*schema)));
Expand Down
8 changes: 8 additions & 0 deletions mutation_partition.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ struct deletable_row final {
t.apply(t_);
}

void apply(api::timestamp_type new_created_at) {
if (new_created_at > created_at) {
created_at = new_created_at;
}
}

friend std::ostream& operator<<(std::ostream& os, const deletable_row& dr);
bool equal(const schema& s, const deletable_row& other) const;
};
Expand Down Expand Up @@ -197,6 +203,8 @@ public:
void apply_delete(schema_ptr schema, const exploded_clustering_prefix& prefix, tombstone t);
void apply_delete(schema_ptr schema, clustering_key&& key, tombstone t);
void apply_delete(schema_ptr schema, clustering_key_view key, tombstone t);
// Equivalent to applying a mutation with an empty row, created with given timestamp
void apply_insert(const schema& s, clustering_key_view, api::timestamp_type created_at);
// prefix must not be full
void apply_row_tombstone(const schema& schema, clustering_key_prefix prefix, tombstone t);
void apply(schema_ptr schema, const mutation_partition& p);
Expand Down

0 comments on commit 386d17d

Please sign in to comment.