IPFSDictChain Module
Dictionary-like data structure that stores its state on IPFS and keeps track of changes.
- class ipfs_dict_chain.IPFSDictChain.IPFSDictChain(cid: str | None = None)[source]
Bases:
IPFSDictA dictionary-like data structure that stores its state on IPFS and keeps track of changes.
- Parameters:
cid (Optional[str], optional) – The IPFS CID to initialize the dictionary with, defaults to None
- __init__(cid: str | None = None)[source]
Initialize the IPFSDictChain object.
- Parameters:
cid (Optional[str], optional) – The IPFS CID to initialize the dictionary with, defaults to None.
- _get_previous_cid_for(cid: str) str | None[source]
Lightweight fetch of just the previous_cid for a given state CID.
This avoids creating a full IPFSDictChain instance which would make unnecessary network calls for data we don’t need.
- changes() Dict[str, Dict[str, Any]][source]
Returns a dictionary containing the changes between the current state and the previous state.
- get_previous_cids(max_depth: int | None = None) List[str][source]
Returns a list of previous CIDs.
Uses lightweight fetches to traverse the chain without loading full state data.