pub struct CascadeImpl<Network: Send + Sync = HolochainP2pDna> { /* private fields */ }
Expand description

The Cascade is a multi-tiered accessor for Holochain DHT data.

See the module-level docs for more info.

Implementations§

source§

impl<Network> CascadeImpl<Network>
where Network: HolochainP2pDnaT + Clone + 'static + Send + Sync,

source

pub fn with_authored(self, authored: DbRead<DbKindAuthored>) -> Self

Add the authored env to the cascade.

source

pub fn with_private_data(self, author: Arc<AgentPubKey>) -> Self

Add the ability to access private entries for this agent.

source

pub fn with_dht(self, dht: DbRead<DbKindDht>) -> Self

Add the dht env to the cascade.

source

pub fn with_cache(self, cache: DbWrite<DbKindCache>) -> Self

Add the cache to the cascade.

source

pub fn with_scratch(self, scratch: SyncScratch) -> Self

Add the cache to the cascade.

source

pub fn with_network<N: HolochainP2pDnaT>( self, network: N, cache_db: DbWrite<DbKindCache> ) -> CascadeImpl<N>

Add the network and cache to the cascade.

source§

impl CascadeImpl<HolochainP2pDna>

source

pub fn empty() -> Self

Constructs an empty Cascade.

source

pub fn from_workspace_and_network<N, AuthorDb, DhtDb>( workspace: &HostFnWorkspace<AuthorDb, DhtDb>, network: N ) -> CascadeImpl<N>

Construct a Cascade with network access

source

pub fn from_workspace_stores( stores: HostFnStores, author: Option<Arc<AgentPubKey>> ) -> Self

Construct a Cascade with local-only access to the provided stores

source§

impl<Network> CascadeImpl<Network>
where Network: HolochainP2pDnaT + Clone + 'static + Send,

source

pub async fn fetch_record( &self, hash: AnyDhtHash, options: NetworkGetOptions ) -> CascadeResult<()>

Fetch a Record from the network, caching and returning the results

source

pub async fn get_entry_details( &self, entry_hash: EntryHash, options: GetOptions ) -> CascadeResult<Option<EntryDetails>>

Get Entry data along with all CRUD actions associated with it.

Also returns Rejected actions, which may affect the interpreted validity status of this Entry.

source

pub async fn get_record_details( &self, action_hash: ActionHash, options: GetOptions ) -> CascadeResult<Option<RecordDetails>>

Get the specified Record along with all Updates and Deletes associated with it.

Can return a Rejected Record.

source

pub async fn dht_get_action( &self, action_hash: ActionHash, options: GetOptions ) -> CascadeResult<Option<Record>>

Returns the [Record] for this ActionHash if it is live by getting the latest available metadata from authorities combined with this agents authored data. Note: Deleted actions are a tombstone set

source

pub async fn dht_get_entry( &self, entry_hash: EntryHash, options: GetOptions ) -> CascadeResult<Option<Record>>

Returns the oldest live [Record] for this EntryHash by getting the latest available metadata from authorities combined with this agents authored data.

source

pub async fn get_concurrent<I: IntoIterator<Item = AnyDhtHash>>( &self, hashes: I, options: GetOptions ) -> CascadeResult<Vec<Option<Record>>>

Perform a concurrent get on multiple hashes simultaneously, returning the resulting list of Records in the order that they come in (NOT the order in which they were requested!).

source

pub async fn dht_get( &self, hash: AnyDhtHash, options: GetOptions ) -> CascadeResult<Option<Record>>

Updates the cache with the latest network authority data and returns what is in the cache. This gives you the latest possible picture of the current dht state. Data from your zome call is also added to the cache.

source

pub async fn get_details( &self, hash: AnyDhtHash, options: GetOptions ) -> CascadeResult<Option<Details>>

Get either EntryDetails or RecordDetails, depending on the hash provided

Gets an links from the cas or cache depending on it’s metadata

Return all CreateLink actions and DeleteLink actions ordered by time.

Count the number of links matching the query.

source

pub async fn must_get_agent_activity( &self, author: AgentPubKey, filter: ChainFilter ) -> CascadeResult<MustGetAgentActivityResponse>

Request a hash bounded chain query.

source

pub async fn get_agent_activity( &self, agent: AgentPubKey, query: ChainQueryFilter, options: GetActivityOptions ) -> CascadeResult<AgentActivityResponse<Record>>

Get agent activity from agent activity authorities. Hashes are requested from the authority and cache for valid chains. Options:

  • include_valid_activity will include the valid chain hashes.
  • include_rejected_activity will include the invalid chain hashes.
  • include_full_actions will fetch the valid actions in parallel (requires include_valid_activity) Query:
  • include_entries will also fetch the entries in parallel (requires include_full_actions)
  • sequence_range will get all the activity in the exclusive range
  • action_type and entry_type will filter the activity (requires include_full_actions)

Trait Implementations§

source§

impl<Network> Cascade for CascadeImpl<Network>
where Network: HolochainP2pDnaT + Clone + 'static + Send,

source§

fn retrieve_entry<'life0, 'async_trait>( &'life0 self, hash: EntryHash, options: NetworkGetOptions ) -> Pin<Box<dyn Future<Output = CascadeResult<Option<(EntryHashed, CascadeSource)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve [Entry] either locally or from an authority. Data might not have been validated yet by the authority.
source§

fn retrieve_action<'life0, 'async_trait>( &'life0 self, hash: ActionHash, options: NetworkGetOptions ) -> Pin<Box<dyn Future<Output = CascadeResult<Option<(SignedActionHashed, CascadeSource)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve [SignedActionHashed] from either locally or from an authority. Data might not have been validated yet by the authority.
source§

fn retrieve<'life0, 'async_trait>( &'life0 self, hash: AnyDhtHash, options: NetworkGetOptions ) -> Pin<Box<dyn Future<Output = CascadeResult<Option<(Record, CascadeSource)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve data from either locally or from an authority. Data might not have been validated yet by the authority.
source§

impl<Network: Clone + Send + Sync> Clone for CascadeImpl<Network>

source§

fn clone(&self) -> CascadeImpl<Network>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Network = HolochainP2pDna> !RefUnwindSafe for CascadeImpl<Network>

§

impl<Network> Send for CascadeImpl<Network>

§

impl<Network> Sync for CascadeImpl<Network>

§

impl<Network> Unpin for CascadeImpl<Network>
where Network: Unpin,

§

impl<Network = HolochainP2pDna> !UnwindSafe for CascadeImpl<Network>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more