mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 12:06:44 +00:00
idl-compiler: Add pos and rollback to serialize vector
This adds the ability to store a position of a serialized vector and to rollback to that stored position afterwards. Signed-off-by: Amnon Heiman <amnon@scylladb.com> Message-Id: <1456041750-1505-3-git-send-email-amnon@scylladb.com>
This commit is contained in:
committed by
Tomasz Grabiec
parent
ea97e07ed7
commit
f461ebc411
@@ -338,6 +338,15 @@ def vector_add_method(current, base_state):
|
||||
after_${basestate}__$name end_$name() && {
|
||||
_size.set(_out, _count);
|
||||
return { _out, std::move(_state) };
|
||||
}
|
||||
|
||||
vector_position pos() const {
|
||||
return vector_position{_out.pos(), _count};
|
||||
}
|
||||
|
||||
void rollback(const vector_position& vp) {
|
||||
_out.retract(vp.pos);
|
||||
_count = vp.count;
|
||||
}""").substitute({'name': current["name"], 'basestate' : base_state})
|
||||
|
||||
def add_param_writer_basic_type(name, base_state, typ, var_type = "", var_index = None, root_node = False):
|
||||
|
||||
Reference in New Issue
Block a user