#holochain #cascade #retrieve #dht #cache #local #cascading

holochain_cascade

Logic for cascading updates to Holochain state and network interaction

188 releases

new 0.4.0-dev.13 Jul 17, 2024
0.4.0-dev.10 Jun 26, 2024
0.3.0-beta-dev.42 Mar 27, 2024
0.3.0-beta-dev.29 Dec 22, 2023
0.0.2 Jul 29, 2021

#1873 in Magic Beans

Download history 361/week @ 2024-03-28 604/week @ 2024-04-04 525/week @ 2024-04-11 405/week @ 2024-04-18 900/week @ 2024-04-25 598/week @ 2024-05-02 331/week @ 2024-05-09 524/week @ 2024-05-16 542/week @ 2024-05-23 800/week @ 2024-05-30 828/week @ 2024-06-06 593/week @ 2024-06-13 510/week @ 2024-06-20 451/week @ 2024-06-27 550/week @ 2024-07-04 424/week @ 2024-07-11

2,125 downloads per month
Used in 8 crates (via holochain)

Apache-2.0 and AGPL-3.0 WITH mif-exception

2.5MB
57K 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

~78–115MB
~2M SLoC