Expand description
§spacedb-sdk — the developer’s whole world
One surface over the entire SpaceDB stack. You open an
offline-first local replica, define a Schema where
each field declares its CrdtType and consistency Tier, and run ops that
are mID-authorized, budget-bounded, and honest — every write and
read returns the Outcome it actually achieved (Local, Committed{tier},
Stale{lag}, Unavailable{reason}). Strong-tier fields go through a quorum
that fails safe under partition; reactive Watchers and CRDT
export/import sync round it out.
use spacedb_sdk::{Database, Schema, CrdtType, Tier, Identity};
let owner = Identity::generate("did:mata:owner").unwrap();
let mut db = Database::open(Identity::generate("did:mata:home-1").unwrap());
db.register_identity(&owner).unwrap();
db.define(
Schema::new("profile")
.field("bio", CrdtType::Text, Tier::Convergent)
.field("username", CrdtType::Register, Tier::Strong),
);Open-core (MIT). Composes spacedb-crdt, -access, -consistency, -meter.
Structs§
- Budget
- A remaining spend allowance, in micro-
$MATA. - Capability
- A grant of access from an issuer to a bearer.
- Database
- An offline-first SpaceDB replica.
- Did
- An identity reference: who an issuer/bearer is. Resolved to a key via the directory.
- Field
Spec - A field’s representation and guarantee.
- Identity
- A P-256 keypair bound to a
Did. Signs capabilities and sub-grants; its public key is published to a directory for verifiers. - MemKey
Directory - In-memory DID → key directory, for tests and single-machine use.
- Ops
- The operations a capability grants — a bitset of read / write / compute.
- Revocation
Set - The set of revoked capability ids known to a node.
- Schema
- The fields of a collection.
- Session
- An authenticated, budgeted context for operations.
- Signed
Capability - A capability plus the issuer’s signature over its canonical bytes.
- Watcher
- Watches a document’s revision counter for changes.
Enums§
- Crdt
Type - The CRDT a field is represented by — its merge semantics.
- Outcome
- The consistency a read or write actually achieved.
- Reject
Reason - Why a strong op was refused by the invariant (the quorum was reached).
- Scope
- What a capability applies to.
- SdkError
- Strong
Result - The result of a strong op.
Committed/Rejectedmean the quorum was reached and gave a definitive, linearizable answer;Unavailablemeans it was not reached and nothing was committed. - Tier
- The consistency a field is served at.
- Unavailable
Reason - Why a (strong) op could not be served.
Functions§
- rusty_
alloc_ enabled - Whether this build installed
rusty_allocas the global allocator. - secure_
allocator_ enabled - Whether the hardened
secureprofile (guard pages, encrypted free lists) is compiled in.