pub struct SenderTaggingStore { /* private fields */ }Expand description
Stores sender tagging data for synchronizing sender tagging indexes.
Tracks pending indexes (used but not yet finalized) and finalized indexes (included in proven blocks) per directional app tagging secret.
Implementations§
Source§impl SenderTaggingStore
impl SenderTaggingStore
pub fn new(kv: Arc<dyn KvStore>) -> SenderTaggingStore
Sourcepub async fn store_pending_indexes(
&self,
pre_tags: &[PreTag],
) -> Result<(), Error>
pub async fn store_pending_indexes( &self, pre_tags: &[PreTag], ) -> Result<(), Error>
Store pending indexes from pre-tags.
Validates:
- No duplicate secrets in pre-tags
- Index is within WINDOW_LEN of finalized index
- Index is greater than finalized index
- No duplicate secret+txHash pairs with different indexes
Sourcepub async fn get_tx_hashes_of_pending_indexes(
&self,
secret: &Fr,
from_index: u64,
to_index: u64,
) -> Result<Vec<TxHash>, Error>
pub async fn get_tx_hashes_of_pending_indexes( &self, secret: &Fr, from_index: u64, to_index: u64, ) -> Result<Vec<TxHash>, Error>
Get transaction hashes of pending indexes within a range.
Sourcepub async fn get_last_finalized_index(&self, secret: &Fr) -> Result<u64, Error>
pub async fn get_last_finalized_index(&self, secret: &Fr) -> Result<u64, Error>
Get the last finalized index for a secret.
Sourcepub async fn get_last_used_index(&self, secret: &Fr) -> Result<u64, Error>
pub async fn get_last_used_index(&self, secret: &Fr) -> Result<u64, Error>
Get the last used index (max of pending and finalized).
Sourcepub async fn get_next_index(&self, secret: &Fr) -> Result<u64, Error>
pub async fn get_next_index(&self, secret: &Fr) -> Result<u64, Error>
Get the next available tag index for a secret and increment.
Sourcepub async fn drop_pending_indexes(
&self,
tx_hashes: &[TxHash],
) -> Result<(), Error>
pub async fn drop_pending_indexes( &self, tx_hashes: &[TxHash], ) -> Result<(), Error>
Drop pending indexes for dropped transactions.
Sourcepub async fn finalize_pending_indexes(
&self,
secret: &Fr,
up_to_index: u64,
) -> Result<(), Error>
pub async fn finalize_pending_indexes( &self, secret: &Fr, up_to_index: u64, ) -> Result<(), Error>
Finalize pending indexes: mark them as finalized and prune lower ones.
Sourcepub async fn get_all_pending(
&self,
) -> Result<HashMap<Fr, Vec<PendingTagIndex>>, Error>
pub async fn get_all_pending( &self, ) -> Result<HashMap<Fr, Vec<PendingTagIndex>>, Error>
Get pending indexes as a map (secret → entries).
Auto Trait Implementations§
impl Freeze for SenderTaggingStore
impl !RefUnwindSafe for SenderTaggingStore
impl Send for SenderTaggingStore
impl Sync for SenderTaggingStore
impl Unpin for SenderTaggingStore
impl !UnwindSafe for SenderTaggingStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more