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

holochain_cascade

Logic for cascading updates to Holochain state and network interaction

227 releases

new 0.5.0-dev.10 Dec 18, 2024
0.5.0-dev.7 Nov 27, 2024
0.4.0 Dec 17, 2024
0.4.0-dev.15 Jul 31, 2024
0.0.2 Jul 29, 2021

#170 in Magic Beans

Download history 266/week @ 2024-08-26 330/week @ 2024-09-02 500/week @ 2024-09-09 862/week @ 2024-09-16 826/week @ 2024-09-23 586/week @ 2024-09-30 388/week @ 2024-10-07 738/week @ 2024-10-14 284/week @ 2024-10-21 325/week @ 2024-10-28 360/week @ 2024-11-04 283/week @ 2024-11-11 455/week @ 2024-11-18 573/week @ 2024-11-25 446/week @ 2024-12-02 516/week @ 2024-12-09

2,005 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