Content Addressable Storage (CAS)

Content Addressable Storage (CAS) is a persistent storage of content where the primary key is the hash of the content. This ensures that content for a given key is immutable, i.e. if the content changes then the primary key changes.

Orb supports two types of CAS: local storage (in a database) and IPFS. The type of CAS storage that an Orb instance uses is dictated by the startup parameter, cas-type. Additionally, if cas-type is set to local and the startup parameter, replicate-local-cas-writes-in-ipfs, is set to true, then CAS data is stored in the local database and also replicated to IPFS.

Local

A local CAS storage is simply a database that stores content using the sha-256 multihash of the content as the primary key. The content is not automatically replicated (as is the case with IPFS). A local CAS storage relies on ActivityPub activities (Create and Announce) to replicate data.

IPFS

If the cas-type is set to ipfs then an additional startup parameter, ipfs-url is required to point to the IPFS node. The IPFS node must have permissions to read and write content. This node replicates the content to other IPFS nodes in the network.

The version of the content ID (CID) that is used as the key for content retrieval is specified with startup parameter cid-version.