Expand description
Replicated documents for the Offline Protocol SDK.
Messaging is synced events; this crate is synced state. A document is a set of collections that any member of a space can edit while offline, merging deterministically when the replicas meet again.
§What this crate deliberately does not do
It does not persist, encrypt, or send anything. It turns edits into
opaque byte deltas and turns byte deltas back into state, and that is
all. Storage, sealing and delivery belong to the main offline-protocol
crate, which already carries ten releases of reliability work this layer
inherits for free.
§The engine is an implementation detail
A CRDT engine is embedded here and named nowhere in this crate’s public API. No engine type appears in a signature, in the FFI surface, or in any binding. One leaked engine type and the engine could never be replaced without a breaking release everywhere, which is exactly the lock-in this layer exists to avoid.
Re-exports§
pub use doc::blob_end_version;pub use doc::BlobMeta;pub use doc::CatchUp;pub use doc::DataDoc;pub use doc::Delta;pub use doc::DocStats;pub use doc::ImportOutcome;pub use doc::RemoteImport;pub use doc::VersionToken;pub use error::DataError;pub use error::DataResult;pub use policy::should_compact;pub use policy::size_verdict;pub use policy::SizeVerdict;pub use policy::COMPACT_DELTA_LOG_RATIO;pub use policy::COMPACT_MAX_COMMITS;pub use policy::COMPACT_MIN_DELTA_LOG_BYTES;pub use policy::DOC_SIZE_WARN_BYTES;pub use policy::MAX_DOC_BYTES;pub use value::DataValue;
Modules§
- doc
- Document, collections, deltas and encoding. The replicated document: collections, commits, and encoding.
- error
- Error types. Errors raised by the data layer.
- policy
- Size caps and the compaction trigger. Size caps and the compaction trigger.
- value
- Values stored in collections. Values that can be stored in a document collection.
Constants§
- ATTACHMENT_
HASH_ LEN - Number of hex characters in an attachment hash, a SHA-256.
- MAX_
ATTACHMENT_ MIME_ LEN - Longest accepted attachment media type.
- MAX_
ATTACHMENT_ NAME_ LEN - Longest accepted attachment display name.
- MAX_
ATTACHMENT_ SIZE - Largest size an attachment reference may declare.
- MAX_
KEY_ LEN - Longest accepted map key.
- MAX_
NAME_ LEN - Longest accepted name for a space, document or collection.
- MAX_
VALUE_ BYTES - Longest accepted single value, equal to the whole-document cap.
Functions§
- validate_
attachment - Check an attachment reference.
- validate_
attachment_ hash - Check that a string is a well-formed attachment address.
- validate_
key - Check a map key.
- validate_
name - Check a space, document, or collection name.
- validate_
space_ name - Check a space name.
- validate_
value - Check the size of a single value.
- validate_
value_ len - Check a value length against
MAX_VALUE_BYTES.