LookupBuilder
pub struct LookupBuilder<'a> { /* private fields */ }A builder for KVStore lookups, supporting advanced features like asynchronous execution.
store.build_lookup() .execute("key1")?;Synchronous and Asynchronous support
LookupBuilder exposes the ability to issue an asynchronous lookup. Using
execute_async will send the request, and unblock. There is currently no polling mechanism.
To retrieve the result, use the blocking function pending_lookup_wait.
Examples
// synchronous non-builder lookuplet result: Result<LookupResponse, KVStoreError> = store.lookup("key");// synchronous builder lookuplet result: Result<LookupResponse, KVStoreError> = store.build_lookup().execute("key");// asynchronous builder lookuplet lookup_handle: Result<PendingLookupHandle, KVStoreError> = store.build_lookup().execute_async("key");let result: Result<LookupResponse, KVStoreError> = store.pending_lookup_wait(lookup_handle?);Methods
execute
View sourceInitiate and wait on an lookup of a value in the KV Store.
Returns Ok(LookupResponse) if the value is retrieved without error, and KVStoreError if the lookup failed.
Parameters
- self: &Self
- key: &str
Returns
Result<LookupResponse, KVStoreError>
execute_async
View sourceInitiate async lookup of a value in the KV Store.
Returns Ok(Some(PendingLookupHandle)) if lookup creation is successful.
Parameters
- self: &Self
- key: &str
Returns
Result<PendingLookupHandle, KVStoreError>