operation

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

operation a serializable operation that can be appended to IPFS log

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpDoc

type OpDoc interface {
	GetKey() string
	GetValue() []byte
}

func NewOpDoc

func NewOpDoc(key string, value []byte) OpDoc

type Operation

type Operation interface {
	// GetKey Gets a key if applicable (ie. key value stores)
	GetKey() *string

	// GetOperation Returns an operation name (ie. append, put, remove)
	GetOperation() string

	// GetValue Returns the operation payload
	GetValue() []byte

	// GetEntry Gets the underlying IPFS log Entry
	GetEntry() ipfslog.Entry

	// GetDocs Gets the list of documents
	GetDocs() []OpDoc

	// Marshal Serializes the operation
	Marshal() ([]byte, error)
}

Operation Describe an CRDT operation

func NewOperation

func NewOperation(key *string, op string, value []byte) Operation

NewOperation Creates a new operation

func NewOperationWithDocuments

func NewOperationWithDocuments(key *string, op string, docs map[string][]byte) Operation

NewOperationWithDocuments Creates a new operation from a map of batched documents

func ParseOperation

func ParseOperation(e ipfslog.Entry) (Operation, error)

ParseOperation Gets the operation from an entry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL