-
Notifications
You must be signed in to change notification settings - Fork 5
/
models.go
84 lines (59 loc) · 2.36 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
Copyright Gen Digital Inc. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package operation
// Property contains a key-value pair.
type Property struct {
Key string
Value interface{}
}
// Operation holds minimum information required for parsing/validating client request.
type Operation struct {
// Type defines operation type.
Type Type
// UniqueSuffix defines document unique suffix.
UniqueSuffix string
// ID defines ID
ID string
// OperationRequest is the original operation request
OperationRequest []byte
// AnchorOrigin defines anchor origin.
AnchorOrigin interface{}
// Properties contains an arbitrary set of implementation-specific name-value pairs.
Properties []Property
}
// AnchoredOperation defines an anchored operation (stored in document operation store).
type AnchoredOperation struct {
// Type defines operation type.
Type Type `json:"type"`
// UniqueSuffix defines document unique suffix.
UniqueSuffix string `json:"uniqueSuffix"`
// OperationRequest is the original operation request
OperationRequest []byte `json:"operation"`
// TransactionTime is the logical anchoring time (block number in case of blockchain) for this operation in the
// anchoring system (blockchain).
TransactionTime uint64 `json:"transactionTime"`
// TransactionNumber is the transaction number of the transaction this operation was batched within.
TransactionNumber uint64 `json:"transactionNumber"`
// ProtocolVersion is the genesis time (version) of the protocol that was used for this operation.
ProtocolVersion uint64 `json:"protocolVersion"`
// CanonicalReference contains canonical reference that applies to this operation.
CanonicalReference string `json:"canonicalReference,omitempty"`
// EquivalenceReferences contains equivalence reference that applies to this operation.
EquivalentReferences []string `json:"equivalentReferences,omitempty"`
// AnchorOrigin is anchor origin
AnchorOrigin interface{} `json:"anchorOrigin,omitempty"`
}
// Type defines valid values for operation type.
type Type string
const (
// TypeCreate captures "create" operation type.
TypeCreate Type = "create"
// TypeUpdate captures "update" operation type.
TypeUpdate Type = "update"
// TypeDeactivate captures "deactivate" operation type.
TypeDeactivate Type = "deactivate"
// TypeRecover captures "recover" operation type.
TypeRecover Type = "recover"
)