Add Replica::num_undo_points and exclude undo points from num_operations
This commit is contained in:
@@ -360,7 +360,8 @@ pub unsafe extern "C" fn tc_replica_undo(rep: *mut TCReplica, undone_out: *mut i
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the number of local, un-synchronized operations, or -1 on error
|
||||
/// Get the number of local, un-synchronized operations (not including undo points), or -1 on
|
||||
/// error.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn tc_replica_num_local_operations(rep: *mut TCReplica) -> i64 {
|
||||
wrap(
|
||||
@@ -373,6 +374,19 @@ pub unsafe extern "C" fn tc_replica_num_local_operations(rep: *mut TCReplica) ->
|
||||
)
|
||||
}
|
||||
|
||||
/// Get the number of undo points (number of undo calls possible), or -1 on error.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn tc_replica_num_undo_points(rep: *mut TCReplica) -> i64 {
|
||||
wrap(
|
||||
rep,
|
||||
|rep| {
|
||||
let count = rep.num_undo_points()? as i64;
|
||||
Ok(count)
|
||||
},
|
||||
-1,
|
||||
)
|
||||
}
|
||||
|
||||
/// Add an UndoPoint, if one has not already been added by this Replica. This occurs automatically
|
||||
/// when a change is made. The `force` flag allows forcing a new UndoPoint even if one has already
|
||||
/// been created by this Replica, and may be useful when a Replica instance is held for a long time
|
||||
|
||||
Reference in New Issue
Block a user