dpp/document/document_methods/
mod.rs1use crate::data_contract::document_type::DocumentTypeRef;
2use crate::data_contract::DataContract;
3use crate::version::PlatformVersion;
4use crate::ProtocolError;
5
6mod get_raw_for_contract;
7mod get_raw_for_document_type;
8mod hash;
9mod is_equal_ignoring_timestamps;
10
11pub(in crate::document) use get_raw_for_contract::*;
12pub(in crate::document) use get_raw_for_document_type::*;
13pub(in crate::document) use hash::*;
14pub(in crate::document) use is_equal_ignoring_timestamps::*;
15
16pub trait DocumentMethodsV0 {
17 fn get_raw_for_contract(
19 &self,
20 key: &str,
21 document_type_name: &str,
22 contract: &DataContract,
23 owner_id: Option<[u8; 32]>,
24 platform_version: &PlatformVersion,
25 ) -> Result<Option<Vec<u8>>, ProtocolError>;
26
27 fn get_raw_for_document_type(
29 &self,
30 key_path: &str,
31 document_type: DocumentTypeRef,
32 owner_id: Option<[u8; 32]>,
33 platform_version: &PlatformVersion,
34 ) -> Result<Option<Vec<u8>>, ProtocolError>;
35
36 fn hash(
37 &self,
38 contract: &DataContract,
39 document_type: DocumentTypeRef,
40 platform_version: &PlatformVersion,
41 ) -> Result<Vec<u8>, ProtocolError>;
42
43 fn increment_revision(&mut self) -> Result<(), ProtocolError>;
44
45 fn is_equal_ignoring_time_based_fields(
53 &self,
54 rhs: &Self,
55 also_ignore_fields: Option<Vec<&str>>,
56 platform_version: &PlatformVersion,
57 ) -> Result<bool, ProtocolError>;
58}