Expand description
The Cascade is a multi-tiered accessor for Holochain DHT data.
It is named “the cascade” because it performs cascading lookups across multiple sources. In general, the flow is:
- Search in local storage, including the
DhtStoreandSyncScratch. - If the data are not found locally, request the data from the network. Network responses are
cached into the
DhtStore
Not all lookups follow this pattern, namely links are treated differently. Where a lookup doesn’t follow this pattern, it is documented in the method documentation.
In order to support apps that want to be able to operate offline, a GetStrategy can be
provided. Making a GetStrategy::Local request will avoid the network entirely. Making a
GetStrategy::Network request will allow the cascade to go to the network, but not force it
to. That means that if the requested data is available locally, the cascade won’t attempt to
fetch it again.
§Retrieve vs Get
There are two words used in cascade functions: “get”, and “retrieve”. They mean distinct things:
- “get” ignores invalid data, and sometimes takes into account CRUD metadata before returning the data, so for instance, Deletes are allowed to annihilate Creates so that neither is returned. This is a more “refined” form of fetching data.
- “retrieve” only fetches the data if it exists, without regard to validation status. This is a more “raw” form of fetching data.
Modules§
- authority
- Functions for the various authorities to handle queries.
- error
- get_
options_ ext - Extension trait to convert GetOptions to NetworkRequestOptions.
Structs§
- Cascade
Impl - The cascade is a multi-tiered accessor for Holochain DHT data.
- Cascade
Options - Options for configuring cascade lookups.
Enums§
- Cascade
Source - Marks whether data came from a local store or another node on the network
Traits§
- Cascade
- A trait for accessing the cascade which can be mocked.