kvproc

package
v0.0.1-78 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeleteCrc32c CRC-32 checksum represents the body hash of "Deleted" document.
	DeleteCrc32c = "0x00000000"
)

Variables

View Source
var (
	ErrNotSupported           = errors.New("not supported")
	ErrNotMyVbucket           = errors.New("not my vbucket")
	ErrInternal               = errors.New("internal error")
	ErrDocExists              = errors.New("doc exists")
	ErrDocNotFound            = errors.New("doc not found")
	ErrValueTooBig            = errors.New("doc value too big")
	ErrCasMismatch            = errors.New("cas mismatch")
	ErrLocked                 = errors.New("locked")
	ErrNotLocked              = errors.New("not locked")
	ErrInvalidArgument        = errors.New("invalid packet")
	ErrSdToManyTries          = errors.New("subdocument too many attempts")
	ErrSdNotJSON              = errors.New("subdocument not json")
	ErrSdPathInvalid          = errors.New("subdocument path invalid")
	ErrSdPathMismatch         = errors.New("subdocument path mismatch")
	ErrSdPathNotFound         = errors.New("subdocument path not found")
	ErrSdPathExists           = errors.New("subdocument path exists")
	ErrSdCantInsert           = errors.New("subdocument cant insert")
	ErrSdBadCombo             = errors.New("subdocument invalid combo")
	ErrSdInvalidFlagCombo     = errors.New("invalid xattr flag combination")
	ErrUnknownXattrMacro      = errors.New("unknown xattr macro")
	ErrSdInvalidXattr         = errors.New("there is something wrong with the syntax of the provided XATTR")
	ErrSdCannotModifyVattr    = errors.New("xattr cannot modify virtual attribute")
	ErrSdXattrInvalidKeyCombo = errors.New("invalid xattr key combination")
)

This is a list of errors we support

Functions

func StringifySubDocPath

func StringifySubDocPath(comps []SubDocPathComponent) string

StringifySubDocPath takes a list of components and stringify's it.

Types

type CounterOptions

type CounterOptions struct {
	Vbucket      uint
	CollectionID uint
	Key          []byte
	Cas          uint64
	Initial      uint64
	Delta        uint64
	Expiry       uint32
}

CounterOptions specifies options for a INCREMENT or DECREMENT operation.

type CounterResult

type CounterResult struct {
	Cas    uint64
	Value  uint64
	VbUUID uint64
	SeqNo  uint64
}

CounterResult contains the results of a INCREMENT or DECREMENT operation.

type DeleteOptions

type DeleteOptions struct {
	Vbucket      uint
	CollectionID uint
	Key          []byte
	Cas          uint64
}

DeleteOptions specifies options for a DELETE operation.

type DeleteResult

type DeleteResult struct {
	Cas    uint64
	VbUUID uint64
	SeqNo  uint64
}

DeleteResult contains the results of a DELETE operation.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine represents a specific engine.

func New

func New(db *mockdb.Bucket, vbOwnership []int) *Engine

New creates a new crudproc engine using a mockdb and a list of what replicas are owned by this particular engine.

func (*Engine) Add

func (e *Engine) Add(opts StoreOptions) (*StoreResult, error)

Add performs an ADD operation.

func (*Engine) Append

func (e *Engine) Append(opts StoreOptions) (*StoreResult, error)

Append performs an APPEND operation.

func (*Engine) Decrement

func (e *Engine) Decrement(opts CounterOptions) (*CounterResult, error)

Decrement performs an DECREMENT operation.

func (*Engine) Delete

func (e *Engine) Delete(opts DeleteOptions) (*DeleteResult, error)

Delete performs an DELETE operation.

func (*Engine) Get

func (e *Engine) Get(opts GetOptions) (*GetResult, error)

Get performs a GET operation.

func (*Engine) GetAndTouch

func (e *Engine) GetAndTouch(opts GetAndTouchOptions) (*GetResult, error)

GetAndTouch performs a GET_AND_TOUCH operation.

func (*Engine) GetLocked

func (e *Engine) GetLocked(opts GetLockedOptions) (*GetResult, error)

GetLocked performs a GET_LOCKED operation.

func (*Engine) GetMeta

func (e *Engine) GetMeta(opts GetMetaOptions) (*GetMetaResult, error)

GetMeta performs a GET_META operation.

func (*Engine) GetRandom

func (e *Engine) GetRandom(opts GetRandomOptions) (*GetRandomResult, error)

GetRandom performs a GET_RANDOM operation.

func (*Engine) GetReplica

func (e *Engine) GetReplica(opts GetOptions) (*GetResult, error)

GetReplica performs a GET_REPLICA operation.

func (*Engine) HLC

func (e *Engine) HLC() time.Time

func (*Engine) Increment

func (e *Engine) Increment(opts CounterOptions) (*CounterResult, error)

Increment performs an INCREMENT operation.

func (*Engine) MultiLookup

func (e *Engine) MultiLookup(opts MultiLookupOptions) (*MultiLookupResult, error)

MultiLookup performs an SD_MULTILOOKUP operation.

func (*Engine) MultiMutate

func (e *Engine) MultiMutate(opts MultiMutateOptions) (*MultiMutateResult, error)

MultiMutate performs an SD_MULTIMUTATE operation.

func (*Engine) ObserveSeqNo

func (e *Engine) ObserveSeqNo(opts ObserveSeqNoOptions) (*ObserveSeqNoResult, error)

ObserveSeqNo performs an OBSERVE_SEQNO operation.

func (*Engine) Prepend

func (e *Engine) Prepend(opts StoreOptions) (*StoreResult, error)

Prepend performs an PREPEND operation.

func (*Engine) Replace

func (e *Engine) Replace(opts StoreOptions) (*StoreResult, error)

Replace performs an REPLACE operation.

func (*Engine) Set

func (e *Engine) Set(opts StoreOptions) (*StoreResult, error)

Set performs an SET operation.

func (*Engine) Touch

func (e *Engine) Touch(opts TouchOptions) (*StoreResult, error)

Touch performs a GET_AND_TOUCH operation.

func (*Engine) Unlock

func (e *Engine) Unlock(opts UnlockOptions) (*StoreResult, error)

Unlock performs an UNLOCK operation.

type GetAndTouchOptions

type GetAndTouchOptions struct {
	ReplicaIdx   int
	Vbucket      uint
	CollectionID uint
	Key          []byte
	Expiry       uint32
}

GetAndTouchOptions specifies options for a GET_AND_TOUCH operation.

type GetLockedOptions

type GetLockedOptions struct {
	ReplicaIdx   int
	Vbucket      uint
	CollectionID uint
	Key          []byte
	LockTime     uint32
}

GetLockedOptions specifies options for a GET_LOCKED operation.

type GetMetaOptions

type GetMetaOptions struct {
	Vbucket      uint
	CollectionID uint
	Key          []byte
}

GetMetaOptions specifies options for a GET_META operation.

type GetMetaResult

type GetMetaResult struct {
	Cas       uint64
	Datatype  uint8
	Value     []byte
	Flags     uint32
	IsDeleted bool
	ExpTime   time.Time
	SeqNo     uint64
}

GetMetaResult contains the results of a GET_META operation.

type GetOptions

type GetOptions struct {
	Vbucket      uint
	CollectionID uint
	Key          []byte
}

GetOptions specifies options for a GET operation.

type GetRandomOptions

type GetRandomOptions struct {
	CollectionID uint
}

GetRandomOptions specifies options for a GET_RANDOM operation.

type GetRandomResult

type GetRandomResult struct {
	Cas      uint64
	Datatype uint8
	Value    []byte
	Flags    uint32
	Key      []byte
}

GetRandomResult contains the results of a GET_RANDOM operation.

type GetResult

type GetResult struct {
	Cas      uint64
	Datatype uint8
	Value    []byte
	Flags    uint32
}

GetResult contains the results of a GET operation.

type MultiLookupOptions

type MultiLookupOptions struct {
	Vbucket       uint
	CollectionID  uint
	Key           []byte
	Ops           []*SubDocOp
	AccessDeleted bool
}

MultiLookupOptions specifies options for an SD_MULTILOOKUP operation.

type MultiLookupResult

type MultiLookupResult struct {
	Cas       uint64
	Ops       []*SubDocResult
	IsDeleted bool
}

MultiLookupResult contains the results of a SD_MULTILOOKUP operation.

type MultiMutateOptions

type MultiMutateOptions struct {
	Vbucket         uint
	CollectionID    uint
	Key             []byte
	Ops             []*SubDocOp
	AccessDeleted   bool
	CreateAsDeleted bool
	CreateIfMissing bool
	CreateOnly      bool
	Expiry          uint32
	Cas             uint64
}

MultiMutateOptions specifies options for an SD_MULTIMUTATE operation.

type MultiMutateResult

type MultiMutateResult struct {
	Cas    uint64
	Ops    []*SubDocResult
	VbUUID uint64
	SeqNo  uint64
}

MultiMutateResult contains the results of a SD_MULTIMUTATE operation.

type ObserveSeqNoOptions

type ObserveSeqNoOptions struct {
	Vbucket uint
	VbUUID  uint64
}

ObserveSeqNoOptions specifies options for an OBSERVE_SEQNO operation.

type ObserveSeqNoResult

type ObserveSeqNoResult struct {
	VbUUID       uint64
	CurrentSeqNo uint64
	PersistSeqNo uint64
}

ObserveSeqNoResult contains the results of a OBSERVE_SEQNO operation.

type StoreOptions

type StoreOptions struct {
	Vbucket      uint
	CollectionID uint
	Key          []byte
	Cas          uint64
	Datatype     uint8
	Value        []byte
	Flags        uint32
	Expiry       uint32
}

StoreOptions specifies options for various store operations.

type StoreResult

type StoreResult struct {
	Cas    uint64
	VbUUID uint64
	SeqNo  uint64
}

StoreResult contains the results for various store operations.

type SubDocArrayAddUniqueExecutor

type SubDocArrayAddUniqueExecutor struct {
	// contains filtered or unexported fields
}

SubDocArrayAddUniqueExecutor is an executor for subdocument operations.

func (SubDocArrayAddUniqueExecutor) Execute

Execute performs the subdocument operation.

type SubDocArrayInsertExecutor

type SubDocArrayInsertExecutor struct {
	// contains filtered or unexported fields
}

SubDocArrayInsertExecutor is an executor for subdocument operations.

func (SubDocArrayInsertExecutor) Execute

Execute performs the subdocument operation.

type SubDocArrayPushFirstExecutor

type SubDocArrayPushFirstExecutor struct {
	// contains filtered or unexported fields
}

SubDocArrayPushFirstExecutor is an executor for subdocument operations.

func (SubDocArrayPushFirstExecutor) Execute

Execute performs the subdocument operation.

type SubDocArrayPushLastExecutor

type SubDocArrayPushLastExecutor struct {
	// contains filtered or unexported fields
}

SubDocArrayPushLastExecutor is an executor for subdocument operations.

func (SubDocArrayPushLastExecutor) Execute

Execute performs the subdocument operation.

type SubDocCounterExecutor

type SubDocCounterExecutor struct {
	// contains filtered or unexported fields
}

SubDocCounterExecutor is an executor for subdocument operations.

func (SubDocCounterExecutor) Execute

func (e SubDocCounterExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocDeleteExecutor

type SubDocDeleteExecutor struct {
	// contains filtered or unexported fields
}

SubDocDeleteExecutor is an executor for subdocument operations.

func (SubDocDeleteExecutor) Execute

func (e SubDocDeleteExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocDeleteFullDocExecutor

type SubDocDeleteFullDocExecutor struct {
	// contains filtered or unexported fields
}

SubDocDeleteFullDocExecutor is an executor for subdocument operations.

func (SubDocDeleteFullDocExecutor) Execute

Execute performs the subdocument operation.

type SubDocDictAddExecutor

type SubDocDictAddExecutor struct {
	// contains filtered or unexported fields
}

SubDocDictAddExecutor is an executor for subdocument operations.

func (SubDocDictAddExecutor) Execute

func (e SubDocDictAddExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocDictSetExecutor

type SubDocDictSetExecutor struct {
	// contains filtered or unexported fields
}

SubDocDictSetExecutor is an executor for subdocument operations.

func (SubDocDictSetExecutor) Execute

func (e SubDocDictSetExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute runs this SubDocDictSetExecutor

type SubDocDictSetFullExecutor

type SubDocDictSetFullExecutor struct {
	// contains filtered or unexported fields
}

SubDocDictSetFullExecutor is an executor for subdocument operations.

func (SubDocDictSetFullExecutor) Execute

Execute runs this SubDocDicSetFullExecutor

type SubDocExecutor

type SubDocExecutor interface {
	Execute(op *SubDocOp) (*SubDocResult, error)
}

SubDocExecutor is an executor for subdocument operations.

type SubDocExistsExecutor

type SubDocExistsExecutor struct {
	// contains filtered or unexported fields
}

SubDocExistsExecutor is an executor for subdocument operations.

func (SubDocExistsExecutor) Execute

func (e SubDocExistsExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocGetCountExecutor

type SubDocGetCountExecutor struct {
	// contains filtered or unexported fields
}

SubDocGetCountExecutor is an executor for subdocument operations.

func (SubDocGetCountExecutor) Execute

Execute performs the subdocument operation.

type SubDocGetDocExecutor

type SubDocGetDocExecutor struct {
	// contains filtered or unexported fields
}

SubDocGetDocExecutor is an executor for subdocument operations.

func (SubDocGetDocExecutor) Execute

func (e SubDocGetDocExecutor) Execute(_ *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocGetExecutor

type SubDocGetExecutor struct {
	// contains filtered or unexported fields
}

SubDocGetExecutor is an executor for subdocument get operations.

func (SubDocGetExecutor) Execute

func (e SubDocGetExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocOp

type SubDocOp struct {
	Op           memd.SubDocOpType
	Path         string
	Value        []byte
	CreatePath   bool
	IsXattrPath  bool
	ExpandMacros bool
}

SubDocOp represents one sub-document operation.

type SubDocPathComponent

type SubDocPathComponent struct {
	Path       string
	ArrayIndex int
}

SubDocPathComponent represents one part of a sub-document path.

func ParseSubDocPath

func ParseSubDocPath(path string) ([]SubDocPathComponent, error)

ParseSubDocPath takes a sub-document path and splits it into components.

type SubDocReplaceExecutor

type SubDocReplaceExecutor struct {
	// contains filtered or unexported fields
}

SubDocReplaceExecutor is an executor for subdocument operations.

func (SubDocReplaceExecutor) Execute

func (e SubDocReplaceExecutor) Execute(op *SubDocOp) (*SubDocResult, error)

Execute performs the subdocument operation.

type SubDocResult

type SubDocResult struct {
	Value []byte
	Err   error
}

SubDocResult represents one result from a sub-document operation.

type SubdocMutateError

type SubdocMutateError struct {
	Err error
}

func (SubdocMutateError) Error

func (e SubdocMutateError) Error() string

type TouchOptions

type TouchOptions struct {
	ReplicaIdx   int
	Vbucket      uint
	CollectionID uint
	Key          []byte
	Expiry       uint32
}

TouchOptions specifies options for a TOUCH operation.

type UnlockOptions

type UnlockOptions struct {
	ReplicaIdx   int
	Vbucket      uint
	CollectionID uint
	Key          []byte
	Cas          uint64
}

UnlockOptions specifies options for an UNLOCK operation.

Jump to

Keyboard shortcuts

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