Documentation ¶
Index ¶
- Constants
- Variables
- func StringifySubDocPath(comps []SubDocPathComponent) string
- type CounterOptions
- type CounterResult
- type DeleteOptions
- type DeleteResult
- type Engine
- func (e *Engine) Add(opts StoreOptions) (*StoreResult, error)
- func (e *Engine) Append(opts StoreOptions) (*StoreResult, error)
- func (e *Engine) Decrement(opts CounterOptions) (*CounterResult, error)
- func (e *Engine) Delete(opts DeleteOptions) (*DeleteResult, error)
- func (e *Engine) Get(opts GetOptions) (*GetResult, error)
- func (e *Engine) GetAndTouch(opts GetAndTouchOptions) (*GetResult, error)
- func (e *Engine) GetLocked(opts GetLockedOptions) (*GetResult, error)
- func (e *Engine) GetMeta(opts GetMetaOptions) (*GetMetaResult, error)
- func (e *Engine) GetRandom(opts GetRandomOptions) (*GetRandomResult, error)
- func (e *Engine) GetReplica(opts GetOptions) (*GetResult, error)
- func (e *Engine) HLC() time.Time
- func (e *Engine) Increment(opts CounterOptions) (*CounterResult, error)
- func (e *Engine) MultiLookup(opts MultiLookupOptions) (*MultiLookupResult, error)
- func (e *Engine) MultiMutate(opts MultiMutateOptions) (*MultiMutateResult, error)
- func (e *Engine) ObserveSeqNo(opts ObserveSeqNoOptions) (*ObserveSeqNoResult, error)
- func (e *Engine) Prepend(opts StoreOptions) (*StoreResult, error)
- func (e *Engine) Replace(opts StoreOptions) (*StoreResult, error)
- func (e *Engine) Set(opts StoreOptions) (*StoreResult, error)
- func (e *Engine) Touch(opts TouchOptions) (*StoreResult, error)
- func (e *Engine) Unlock(opts UnlockOptions) (*StoreResult, error)
- type GetAndTouchOptions
- type GetLockedOptions
- type GetMetaOptions
- type GetMetaResult
- type GetOptions
- type GetRandomOptions
- type GetRandomResult
- type GetResult
- type MultiLookupOptions
- type MultiLookupResult
- type MultiMutateOptions
- type MultiMutateResult
- type ObserveSeqNoOptions
- type ObserveSeqNoResult
- type StoreOptions
- type StoreResult
- type SubDocArrayAddUniqueExecutor
- type SubDocArrayInsertExecutor
- type SubDocArrayPushFirstExecutor
- type SubDocArrayPushLastExecutor
- type SubDocCounterExecutor
- type SubDocDeleteExecutor
- type SubDocDeleteFullDocExecutor
- type SubDocDictAddExecutor
- type SubDocDictSetExecutor
- type SubDocDictSetFullExecutor
- type SubDocExecutor
- type SubDocExistsExecutor
- type SubDocGetCountExecutor
- type SubDocGetDocExecutor
- type SubDocGetExecutor
- type SubDocOp
- type SubDocPathComponent
- type SubDocReplaceExecutor
- type SubDocResult
- type SubdocMutateError
- type TouchOptions
- type UnlockOptions
Constants ¶
const (
// DeleteCrc32c CRC-32 checksum represents the body hash of "Deleted" document.
DeleteCrc32c = "0x00000000"
)
Variables ¶
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 ¶
CounterResult contains the results of a INCREMENT or DECREMENT operation.
type DeleteOptions ¶
DeleteOptions specifies options for a DELETE operation.
type DeleteResult ¶
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 ¶
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) 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 ¶
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 ¶
GetOptions specifies options for a GET operation.
type GetRandomOptions ¶
type GetRandomOptions struct {
CollectionID uint
}
GetRandomOptions specifies options for a GET_RANDOM operation.
type GetRandomResult ¶
GetRandomResult contains the results of a GET_RANDOM 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 ¶
ObserveSeqNoOptions specifies options for an OBSERVE_SEQNO operation.
type ObserveSeqNoResult ¶
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 ¶
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 ¶
func (e SubDocArrayAddUniqueExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
func (e SubDocArrayInsertExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
func (e SubDocArrayPushFirstExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
func (e SubDocArrayPushLastExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
func (e SubDocDeleteFullDocExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
func (e SubDocDictSetFullExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
func (e SubDocGetCountExecutor) Execute(op *SubDocOp) (*SubDocResult, error)
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 ¶
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 ¶
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 ¶
TouchOptions specifies options for a TOUCH operation.