Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added Type and Properties to Operation #702

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/api/operation/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ 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 {

Expand All @@ -23,6 +29,9 @@ type Operation struct {

// AnchorOrigin defines anchor origin.
AnchorOrigin interface{}

// Properties contains an arbitrary set of implementation-specific name-value pairs.
Properties []Property
}

// Reference holds minimum information about did operation (suffix and type).
Expand Down Expand Up @@ -90,10 +99,12 @@ const (

// QueuedOperation stores minimum required operation info for operations queue.
type QueuedOperation struct {
Type Type
OperationRequest []byte
UniqueSuffix string
Namespace string
AnchorOrigin interface{}
Properties []Property
}

// QueuedOperationAtTime contains queued operation info with protocol genesis time.
Expand Down
2 changes: 2 additions & 0 deletions pkg/batch/cutter/cutter.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ func getOperationsAtProtocolVersion(opsAtTime []*operation.QueuedOperationAtTime

ops = append(ops,
&operation.QueuedOperation{
Type: op.Type,
OperationRequest: op.OperationRequest,
UniqueSuffix: op.UniqueSuffix,
Namespace: op.Namespace,
Properties: op.Properties,
},
)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/dochandler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,12 @@ func (r *DocumentHandler) resolveRequestWithInitialState(uniqueSuffix, longFormD
func (r *DocumentHandler) addToBatch(op *operation.Operation, versionTime uint64) error {
return r.writer.Add(
&operation.QueuedOperation{
Type: op.Type,
Namespace: r.namespace,
UniqueSuffix: op.UniqueSuffix,
OperationRequest: op.OperationRequest,
AnchorOrigin: op.AnchorOrigin,
Properties: op.Properties,
}, versionTime)
}

Expand Down