Struct fog_pack::schema::Schema [−][src]
pub struct Schema { /* fields omitted */ }Expand description
A Schema, which can be used to encode/decode a document or entry, while verifying its contents.
Schema are decoded from a correctly formatted Document that describes the format of other
documents and their associated entries. They also include recommended compression settings for
documents & entries adhering to them, which may include compression dictionaries.
A schema must come from a Document. To create one directly, use the SchemaBuilder, then
decode the resulting Document into a schema.
Implementations
Attempt to create a schema from a given document. Fails if the document isn’t a schema.
Validate a NewDocument, turning it into a Document. Fails if the document doesn’t
use this schema, or if it doesn’t meet this schema’s
requirements.
Encode a Document, returning the resulting Document’s hash and fully encoded format.
Fails if the document doesn’t use this schema.
Decode a document that uses this schema.
Decode a Document, skipping any checks of the data. This should only be run when the raw
document has definitely been passed through validation before, i.e. if it is stored in a
local database after going through encode_doc.
Encode a NewEntry, returning the resulting Entry’s hash and fully encoded format.
Fails if the entry key isn’t in the schema, or it doesn’t meet the requirements.
The resulting entry is stored in a DataChecklist that must be iterated over in order to
finish verification and get the resulting data.
Encode an Entry, returning the resulting Entry’s hash and fully encoded format.
Fails if the entry key isn’t in the schema, or it doesn’t meet the requirements.
The resulting entry is stored in a DataChecklist that must be iterated over in order to
finish verification and get the resulting data.
pub fn decode_entry(
&self,
entry: Vec<u8>,
key: &str,
parent: &Hash
) -> Result<DataChecklist<'_, Entry>>
pub fn decode_entry(
&self,
entry: Vec<u8>,
key: &str,
parent: &Hash
) -> Result<DataChecklist<'_, Entry>>
Decode an entry, given the key and parent Hash. Result is in a DataChecklist that must
be iterated over in order to finish verification and get the resulting Entry.
Decode a Entry, skipping any checks of the data. This should only be run when the raw
entry has definitely been passed through validation before, i.e. if it is stored in a
local database after going through encode_entry or
encode_new_entry.