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_array_elements_for_document_type;
7mod get_raw_for_contract;
8mod get_raw_for_document_type;
9mod hash;
10mod is_equal_ignoring_timestamps;
11
12pub(in crate::document) use get_raw_array_elements_for_document_type::*;
13pub(in crate::document) use get_raw_for_contract::*;
14pub(in crate::document) use get_raw_for_document_type::*;
15pub(in crate::document) use hash::*;
16pub(in crate::document) use is_equal_ignoring_timestamps::*;
17
18pub trait DocumentMethodsV0 {
19 fn get_raw_for_contract(
21 &self,
22 key: &str,
23 document_type_name: &str,
24 contract: &DataContract,
25 owner_id: Option<[u8; 32]>,
26 platform_version: &PlatformVersion,
27 ) -> Result<Option<Vec<u8>>, ProtocolError>;
28
29 fn get_raw_for_document_type(
31 &self,
32 key_path: &str,
33 document_type: DocumentTypeRef,
34 owner_id: Option<[u8; 32]>,
35 platform_version: &PlatformVersion,
36 ) -> Result<Option<Vec<u8>>, ProtocolError>;
37
38 fn get_raw_array_elements_for_document_type(
41 &self,
42 key_path: &str,
43 document_type: DocumentTypeRef,
44 platform_version: &PlatformVersion,
45 ) -> Result<Vec<Vec<u8>>, ProtocolError>;
46
47 fn hash(
48 &self,
49 contract: &DataContract,
50 document_type: DocumentTypeRef,
51 platform_version: &PlatformVersion,
52 ) -> Result<Vec<u8>, ProtocolError>;
53
54 fn increment_revision(&mut self) -> Result<(), ProtocolError>;
55
56 fn is_equal_ignoring_time_based_fields(
64 &self,
65 rhs: &Self,
66 also_ignore_fields: Option<Vec<&str>>,
67 platform_version: &PlatformVersion,
68 ) -> Result<bool, ProtocolError>;
69}