Skip to content

Commit

Permalink
mutation: Introduce set_static_cell()
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrabiec committed May 8, 2015
1 parent 386d17d commit 6047b6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mutation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ void mutation::set_static_cell(const column_definition& def, atomic_cell_or_coll
update_column(_p.static_row(), def, std::move(value));
}

void mutation::set_static_cell(const bytes& name, const boost::any& value, api::timestamp_type timestamp, ttl_opt ttl) {
auto column_def = _schema->get_column_definition(name);
if (!column_def) {
throw std::runtime_error(sprint("no column definition found for '%s'", name));
}
if (!column_def->is_static()) {
throw std::runtime_error(sprint("column '%s' is not static", name));
}
update_column(_p.static_row(), *column_def, atomic_cell::make_live(timestamp, column_def->type->decompose(value), ttl));
}

void mutation::set_clustered_cell(const exploded_clustering_prefix& prefix, const column_definition& def, atomic_cell_or_collection value) {
auto& row = _p.clustered_row(clustering_key::from_clustering_prefix(*_schema, prefix)).cells;
update_column(row, def, std::move(value));
Expand Down
1 change: 1 addition & 0 deletions mutation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public:
mutation(mutation&&) = default;
mutation(const mutation&) = default;
void set_static_cell(const column_definition& def, atomic_cell_or_collection value);
void set_static_cell(const bytes& name, const boost::any& value, api::timestamp_type timestamp, ttl_opt ttl = {});
void set_clustered_cell(const exploded_clustering_prefix& prefix, const column_definition& def, atomic_cell_or_collection value);
void set_clustered_cell(const clustering_key& key, const bytes& name, const boost::any& value, api::timestamp_type timestamp, ttl_opt ttl = {});
void set_clustered_cell(const clustering_key& key, const column_definition& def, atomic_cell_or_collection value);
Expand Down

0 comments on commit 6047b6d

Please sign in to comment.