API
Store
-
new (path, key) -> Store
- open/create store
-
get (ObjectId) -> Object
-
put (Object) -> ObjectId
- calculate ObjectId from Object hash
- stores Object under ObjectId
-
TODO: store object metadata in an easily queryable way
- expiry for garbage collection
- pin flag
- it can easily be done with the KVS [niko]
Object
-
new (children, deps, expiry, content)
- create an object with the given chunk of content
-
verify (id, object) -> bool
- verify if the object ID matches the object hash
MerkleTree
-
new (store, rootId) -> MerkleTree
- new merkle tree from root object ID that already exists in the store
-
create (store, content, chunkSize) -> MerkleTree
- create new merkle tree from the given content
- performs chunking & encryption of the given content, and creates objects
- returns all objects of a merkle tree, starting from the root
-
verify_children (self) -> list<ObjectId>
- verifies the merkle tree
- traverse all children references
- return missing children
- verifies the merkle tree
-
get_root (self) -> ObjectId
- get root object ID of the merkle tree
-
get_objects (self) -> list<ObjectId>
- get a list of all object IDs in the merkle tree
DAG
-
verify_deps (store, objectId) -> list<ObjectId>
- traverse all deps of the object and check if they are available in the store
- return list of missing deps
-
sync_req (store, heads, knownHeads, knownCommits) -> list<ObjectId>
- sync request from another node
- heads: heads to sync to
- known heads/commits by other node to sync from
- calculate list of object IDs to send
- starting from heads following deps & acks until known heads
- remove known commits
File
new (contentType, metadata, content) -> File
Repository
new (pubkey, branches, allowExtRequests, metadata) -> Repository
Branch
-
new (pubkey, topic, secret, members, quorum, ackDelay, tags, metadata) -> Branch
-
update (self, quorum, ackDelay) -> Branch
- update a branch after an AddMember commit
Commit
-
new (author, seq, branch, deps, acks, refs, metadata, body_ref, expiry, sig_key) -> Commit
- creates new signed commit
-
validate (self, store) -> bool
- check signature
- check author permissions
- check if deps, acks, refs exist in the store, recursively
Member
new (pubkey, commitTypes, metadata) -> Member
AddBranch
new (objectRef) -> AddBranch
RemoveBranch
new (objectRef) -> RemoveBranch
AddMembers
new (members, quorum, ackDelay) -> AddMembers
EndOfBranch
new (fork, expiry) -> EndOfBranch
Transaction
new (content) -> Transaction
Snapshot
new (heads, content) -> Snapshot
PubSub
single-node pub/sub
subscribe (topic)
unsubscribe (topic)
publish (event)