mirror of https://github.com/vacp2p/zerokit.git
chore(rln): expose seq_atomic_operation api (#206)
This commit is contained in:
parent
bf3d1d3309
commit
c6c1bfde91
|
@ -294,6 +294,22 @@ pub extern "C" fn atomic_operation(
|
||||||
call!(ctx, atomic_operation, index, leaves_buffer, indices_buffer)
|
call!(ctx, atomic_operation, index, leaves_buffer, indices_buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn seq_atomic_operation(
|
||||||
|
ctx: *mut RLN,
|
||||||
|
leaves_buffer: *const Buffer,
|
||||||
|
indices_buffer: *const Buffer,
|
||||||
|
) -> bool {
|
||||||
|
call!(
|
||||||
|
ctx,
|
||||||
|
atomic_operation,
|
||||||
|
ctx.process().leaves_set(),
|
||||||
|
leaves_buffer,
|
||||||
|
indices_buffer
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn get_root(ctx: *const RLN, output_buffer: *mut Buffer) -> bool {
|
pub extern "C" fn get_root(ctx: *const RLN, output_buffer: *mut Buffer) -> bool {
|
||||||
|
|
|
@ -406,6 +406,10 @@ impl RLN<'_> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn leaves_set(&mut self) -> usize {
|
||||||
|
self.tree.leaves_set()
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets a leaf value at the next available never-set leaf index.
|
/// Sets a leaf value at the next available never-set leaf index.
|
||||||
///
|
///
|
||||||
/// This function updates the internal Merkle tree `next_index` value indicating the next available index corresponding to a never-set leaf as `next_index = next_index + 1`.
|
/// This function updates the internal Merkle tree `next_index` value indicating the next available index corresponding to a never-set leaf as `next_index = next_index + 1`.
|
||||||
|
|
Loading…
Reference in New Issue