pub struct NoSchema;Expand description
Validation for documents without a schema.
Not all documents adhere to a schema, but they must still be verified for correctness and be
optionally compressed on encoding. This NoSchema struct acts like a Schema to accomplish
this.
As schemaless documents cannot have attached entries, NoSchema does not do any entry
encode/decode.
Implementations§
Source§impl NoSchema
impl NoSchema
Sourcepub fn validate_new_doc(doc: NewDocument) -> Result<Document>
pub fn validate_new_doc(doc: NewDocument) -> Result<Document>
Validate a NewDocument, turning it into a Document. Fails if the internal data
isn’t actually valid fog-pack, which can sometimes happen with a bad Serialize
implementation for the data.
Sourcepub fn encode_doc(doc: Document) -> Result<(Hash, Vec<u8>)>
pub fn encode_doc(doc: Document) -> Result<(Hash, Vec<u8>)>
Re-encode a validated Document, returning the resulting Document’s hash and fully encoded
format.
Sourcepub fn decode_doc(doc: Vec<u8>) -> Result<Document>
pub fn decode_doc(doc: Vec<u8>) -> Result<Document>
Decode a document that doesn’t have a schema.
Sourcepub fn trusted_decode_doc(doc: Vec<u8>) -> Result<Document>
pub fn trusted_decode_doc(doc: Vec<u8>) -> Result<Document>
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.