#holochain #cascade #retrieve #cache #local #accessor #cascading

holochain_cascade

Logic for cascading updates to Holochain state and network interaction

221 releases

new 0.5.0-dev.7 Nov 27, 2024
0.5.0-dev.3 Oct 30, 2024
0.4.0-dev.15 Jul 31, 2024
0.3.0-beta-dev.42 Mar 27, 2024
0.0.2 Jul 29, 2021

#91 in Magic Beans

Download history 360/week @ 2024-08-08 374/week @ 2024-08-15 286/week @ 2024-08-22 293/week @ 2024-08-29 406/week @ 2024-09-05 859/week @ 2024-09-12 688/week @ 2024-09-19 640/week @ 2024-09-26 584/week @ 2024-10-03 582/week @ 2024-10-10 513/week @ 2024-10-17 215/week @ 2024-10-24 396/week @ 2024-10-31 237/week @ 2024-11-07 530/week @ 2024-11-14 321/week @ 2024-11-21

1,572 downloads per month
Used in 8 crates (via holochain)

Apache-2.0 and AGPL-3.0 WITH mif-exception

2.5MB
56K SLoC

holochain_cascade

Cascade

Retrieve vs Get

Get checks CRUD metadata before returning an the data where as retrieve only checks that where the data was found the appropriate validation has been run.


lib.rs:

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

Note that the docs for this crate are admittedly a bit loose and imprecise, but they are not expected to be incorrect.

It is named "the Cascade" because it performs "cascading" gets across multiple sources. In general (but not in all cases), the flow is something like:

  • First attempts to read the local storage
  • If that fails, attempt to read data from the network cache
  • If that fails, do a network request for the data, caching it if found

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.

Dependencies

~75–110MB
~2M SLoC