Skip to main content

Crate offline_protocol_data

Crate offline_protocol_data 

Source
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.