gocbcore

package module
v7.1.18+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: Apache-2.0 Imports: 39 Imported by: 0

README

Couchbase Go Core

This package provides the underlying Couchbase IO for the gocb project. If you are looking for the Couchbase Go SDK, you are probably looking for gocb.

Branching Strategy

The gocbcore library maintains a branch for each major revision of its API. These branches are introduced just prior to any API breaking changes with a internal version code of vX-dev. Once a version is fully assembled and prepared to ship, the version will be updated to reflect a specific full version number (ie vX.0.0), and a tag created for that version number.

An example of this is the v6 branch was created just prior to a breaking change. The v6 branch will contain all changes that have a new API until a release is made (and tag v6.0.0 is created). At which point, any future API changes will be made on branch v7.

License

Copyright 2017 Couchbase Inc.

Licensed under the Apache License, Version 2.0.

See LICENSE for further details.

Documentation

Overview

Package gocbcore implements methods for low-level communication with a Couchbase Server cluster.

Index

Constants

View Source
const (
	// UnknownType indicates the values type is unknown.
	UnknownType = DataType(0)

	// JsonType indicates the value is JSON data.
	JsonType = DataType(1)

	// BinaryType indicates the value is binary data.
	BinaryType = DataType(2)

	// StringType indicates the value is string data.
	StringType = DataType(3)
)
View Source
const (
	// UnknownCompression indicates that the compression type is unknown.
	UnknownCompression = CompressionType(0)

	// NoCompression indicates that no compression is being used.
	NoCompression = CompressionType(1)
)
View Source
const (
	// FeatureDatatype indicates support for Datatype fields.
	FeatureDatatype = HelloFeature(0x01)

	// FeatureTls indicates support for TLS
	FeatureTls = HelloFeature(0x02)

	// FeatureTcpNoDelay indicates support for TCP no-delay.
	FeatureTcpNoDelay = HelloFeature(0x03)

	// FeatureSeqNo indicates support for mutation tokens.
	FeatureSeqNo = HelloFeature(0x04)

	// FeatureTcpDelay indicates support for TCP delay.
	FeatureTcpDelay = HelloFeature(0x05)

	// FeatureXattr indicates support for document xattrs.
	FeatureXattr = HelloFeature(0x06)

	// FeatureXerror indicates support for extended errors.
	FeatureXerror = HelloFeature(0x07)

	// FeatureSelectBucket indicates support for the SelectBucket operation.
	FeatureSelectBucket = HelloFeature(0x08)

	// FeatureCollections indicates support for collections.
	FeatureCollections = HelloFeature(0x09)

	// FeatureSnappy indicates support for snappy compressed documents.
	FeatureSnappy = HelloFeature(0x0a)

	// FeatureJson indicates support for JSON datatype data.
	FeatureJson = HelloFeature(0x0b)

	// FeatureDuplex indicates support for duplex communications.
	FeatureDuplex = HelloFeature(0x0c)

	// FeatureClusterMapNotif indicates support for cluster-map update notifications.
	FeatureClusterMapNotif = HelloFeature(0x0d)

	// FeatureUnorderedExec indicates support for unordered execution of operations.
	FeatureUnorderedExec = HelloFeature(0x0e)

	// FeatureDurations indicates support for server durations.
	FeatureDurations = HelloFeature(0xf)
)
View Source
const (
	// StatusSuccess indicates the operation completed successfully.
	StatusSuccess = StatusCode(0x00)

	// StatusKeyNotFound occurs when an operation is performed on a key that does not exist.
	StatusKeyNotFound = StatusCode(0x01)

	// StatusKeyExists occurs when an operation is performed on a key that could not be found.
	StatusKeyExists = StatusCode(0x02)

	// StatusTooBig occurs when an operation attempts to store more data in a single document
	// than the server is capable of storing (by default, this is a 20MB limit).
	StatusTooBig = StatusCode(0x03)

	// StatusInvalidArgs occurs when the server receives invalid arguments for an operation.
	StatusInvalidArgs = StatusCode(0x04)

	// StatusNotStored occurs when the server fails to store a key.
	StatusNotStored = StatusCode(0x05)

	// StatusBadDelta occurs when an invalid delta value is specified to a counter operation.
	StatusBadDelta = StatusCode(0x06)

	// StatusNotMyVBucket occurs when an operation is dispatched to a server which is
	// non-authoritative for a specific vbucket.
	StatusNotMyVBucket = StatusCode(0x07)

	// StatusNoBucket occurs when no bucket was selected on a connection.
	StatusNoBucket = StatusCode(0x08)

	// StatusLocked occurs when an operation fails due to the document being locked.
	StatusLocked = StatusCode(0x09)

	// StatusAuthStale occurs when authentication credentials have become invalidated.
	StatusAuthStale = StatusCode(0x1f)

	// StatusAuthError occurs when the authentication information provided was not valid.
	StatusAuthError = StatusCode(0x20)

	// StatusAuthContinue occurs in multi-step authentication when more authentication
	// work needs to be performed in order to complete the authentication process.
	StatusAuthContinue = StatusCode(0x21)

	// StatusRangeError occurs when the range specified to the server is not valid.
	StatusRangeError = StatusCode(0x22)

	// StatusRollback occurs when a DCP stream fails to open due to a rollback having
	// previously occurred since the last time the stream was opened.
	StatusRollback = StatusCode(0x23)

	// StatusAccessError occurs when an access error occurs.
	StatusAccessError = StatusCode(0x24)

	// StatusNotInitialized is sent by servers which are still initializing, and are not
	// yet ready to accept operations on behalf of a particular bucket.
	StatusNotInitialized = StatusCode(0x25)

	// StatusUnknownCommand occurs when an unknown operation is sent to a server.
	StatusUnknownCommand = StatusCode(0x81)

	// StatusOutOfMemory occurs when the server cannot service a request due to memory
	// limitations.
	StatusOutOfMemory = StatusCode(0x82)

	// StatusNotSupported occurs when an operation is understood by the server, but that
	// operation is not supported on this server (occurs for a variety of reasons).
	StatusNotSupported = StatusCode(0x83)

	// StatusInternalError occurs when internal errors prevent the server from processing
	// your request.
	StatusInternalError = StatusCode(0x84)

	// StatusBusy occurs when the server is too busy to process your request right away.
	// Attempting the operation at a later time will likely succeed.
	StatusBusy = StatusCode(0x85)

	// StatusTmpFail occurs when a temporary failure is preventing the server from
	// processing your request.
	StatusTmpFail = StatusCode(0x86)

	// StatusSubDocPathNotFound occurs when a sub-document operation targets a path
	// which does not exist in the specifie document.
	StatusSubDocPathNotFound = StatusCode(0xc0)

	// StatusSubDocPathMismatch occurs when a sub-document operation specifies a path
	// which does not match the document structure (field access on an array).
	StatusSubDocPathMismatch = StatusCode(0xc1)

	// StatusSubDocPathInvalid occurs when a sub-document path could not be parsed.
	StatusSubDocPathInvalid = StatusCode(0xc2)

	// StatusSubDocPathTooBig occurs when a sub-document path is too big.
	StatusSubDocPathTooBig = StatusCode(0xc3)

	// StatusSubDocDocTooDeep occurs when an operation would cause a document to be
	// nested beyond the depth limits allowed by the sub-document specification.
	StatusSubDocDocTooDeep = StatusCode(0xc4)

	// StatusSubDocCantInsert occurs when a sub-document operation could not insert.
	StatusSubDocCantInsert = StatusCode(0xc5)

	// StatusSubDocNotJson occurs when a sub-document operation is performed on a
	// document which is not JSON.
	StatusSubDocNotJson = StatusCode(0xc6)

	// StatusSubDocBadRange occurs when a sub-document operation is performed with
	// a bad range.
	StatusSubDocBadRange = StatusCode(0xc7)

	// StatusSubDocBadDelta occurs when a sub-document counter operation is performed
	// and the specified delta is not valid.
	StatusSubDocBadDelta = StatusCode(0xc8)

	// StatusSubDocPathExists occurs when a sub-document operation expects a path not
	// to exists, but the path was found in the document.
	StatusSubDocPathExists = StatusCode(0xc9)

	// StatusSubDocValueTooDeep occurs when a sub-document operation specifies a value
	// which is deeper than the depth limits of the sub-document specification.
	StatusSubDocValueTooDeep = StatusCode(0xca)

	// StatusSubDocBadCombo occurs when a multi-operation sub-document operation is
	// performed and operations within the package of ops conflict with each other.
	StatusSubDocBadCombo = StatusCode(0xcb)

	// StatusSubDocBadMulti occurs when a multi-operation sub-document operation is
	// performed and operations within the package of ops conflict with each other.
	StatusSubDocBadMulti = StatusCode(0xcc)

	// StatusSubDocSuccessDeleted occurs when a multi-operation sub-document operation
	// is performed on a soft-deleted document.
	StatusSubDocSuccessDeleted = StatusCode(0xcd)

	// StatusSubDocXattrInvalidFlagCombo occurs when an invalid set of
	// extended-attribute flags is passed to a sub-document operation.
	StatusSubDocXattrInvalidFlagCombo = StatusCode(0xce)

	// StatusSubDocXattrInvalidKeyCombo occurs when an invalid set of key operations
	// are specified for a extended-attribute sub-document operation.
	StatusSubDocXattrInvalidKeyCombo = StatusCode(0xcf)

	// StatusSubDocXattrUnknownMacro occurs when an invalid macro value is specified.
	StatusSubDocXattrUnknownMacro = StatusCode(0xd0)

	// StatusSubDocXattrUnknownVAttr occurs when an invalid virtual attribute is specified.
	StatusSubDocXattrUnknownVAttr = StatusCode(0xd1)

	// StatusSubDocXattrCannotModifyVAttr occurs when a mutation is attempted upon
	// a virtual attribute (which are immutable by definition).
	StatusSubDocXattrCannotModifyVAttr = StatusCode(0xd2)

	// StatusSubDocMultiPathFailureDeleted occurs when a Multi Path Failure occurs on
	// a soft-deleted document.
	StatusSubDocMultiPathFailureDeleted = StatusCode(0xd3)
)
View Source
const (
	// VbucketStateActive indicates the vbucket is active on this server
	VbucketStateActive = VbucketState(0x01)

	// VbucketStateReplica indicates the vbucket is a replica on this server
	VbucketStateReplica = VbucketState(0x02)

	// VbucketStatePending indicates the vbucket is preparing to become active on this server.
	VbucketStatePending = VbucketState(0x03)

	// VbucketStateDead indicates the vbucket is no longer valid on this server.
	VbucketStateDead = VbucketState(0x04)
)
View Source
const (
	// ForceMetaOp disables conflict resolution for the document and allows the
	// operation to be applied to an active, pending, or replica vbucket.
	ForceMetaOp = SetMetaOption(0x01)

	// UseLwwConflictResolution switches to Last-Write-Wins conflict resolution
	// for the document.
	UseLwwConflictResolution = SetMetaOption(0x02)

	// RegenerateCas causes the server to invalidate the current CAS value for
	// a document, and to generate a new one.
	RegenerateCas = SetMetaOption(0x04)

	// SkipConflictResolution disables conflict resolution for the document.
	SkipConflictResolution = SetMetaOption(0x08)

	// IsExpiration indicates that the message is for an expired document.
	IsExpiration = SetMetaOption(0x10)
)
View Source
const (
	// KeyStateNotPersisted indicates the key is in memory, but not yet written to disk.
	KeyStateNotPersisted = KeyState(0x00)

	// KeyStatePersisted indicates that the key has been written to disk.
	KeyStatePersisted = KeyState(0x01)

	// KeyStateNotFound indicates that the key is not found in memory or on disk.
	KeyStateNotFound = KeyState(0x80)

	// KeyStateDeleted indicates that the key has been written to disk as deleted.
	KeyStateDeleted = KeyState(0x81)
)
View Source
const (
	// SubDocOpGet indicates the operation is a sub-document `Get` operation.
	SubDocOpGet = SubDocOpType(cmdSubDocGet)

	// SubDocOpExists indicates the operation is a sub-document `Exists` operation.
	SubDocOpExists = SubDocOpType(cmdSubDocExists)

	// SubDocOpGetCount indicates the operation is a sub-document `GetCount` operation.
	SubDocOpGetCount = SubDocOpType(cmdSubDocGetCount)

	// SubDocOpDictAdd indicates the operation is a sub-document `Add` operation.
	SubDocOpDictAdd = SubDocOpType(cmdSubDocDictAdd)

	// SubDocOpDictSet indicates the operation is a sub-document `Set` operation.
	SubDocOpDictSet = SubDocOpType(cmdSubDocDictSet)

	// SubDocOpDelete indicates the operation is a sub-document `Remove` operation.
	SubDocOpDelete = SubDocOpType(cmdSubDocDelete)

	// SubDocOpReplace indicates the operation is a sub-document `Replace` operation.
	SubDocOpReplace = SubDocOpType(cmdSubDocReplace)

	// SubDocOpArrayPushLast indicates the operation is a sub-document `ArrayPushLast` operation.
	SubDocOpArrayPushLast = SubDocOpType(cmdSubDocArrayPushLast)

	// SubDocOpArrayPushFirst indicates the operation is a sub-document `ArrayPushFirst` operation.
	SubDocOpArrayPushFirst = SubDocOpType(cmdSubDocArrayPushFirst)

	// SubDocOpArrayInsert indicates the operation is a sub-document `ArrayInsert` operation.
	SubDocOpArrayInsert = SubDocOpType(cmdSubDocArrayInsert)

	// SubDocOpArrayAddUnique indicates the operation is a sub-document `ArrayAddUnique` operation.
	SubDocOpArrayAddUnique = SubDocOpType(cmdSubDocArrayAddUnique)

	// SubDocOpCounter indicates the operation is a sub-document `Counter` operation.
	SubDocOpCounter = SubDocOpType(cmdSubDocCounter)

	// SubDocOpGetDoc represents a full document retrieval, for use with extended attribute ops.
	SubDocOpGetDoc = SubDocOpType(cmdGet)

	// SubDocOpSetDoc represents a full document set, for use with extended attribute ops.
	SubDocOpSetDoc = SubDocOpType(cmdSet)

	// SubDocOpAddDoc represents a full document add, for use with extended attribute ops.
	SubDocOpAddDoc = SubDocOpType(cmdAdd)

	// SubDocOpDeleteDoc represents a full document delete, for use with extended attribute ops.
	SubDocOpDeleteDoc = SubDocOpType(cmdDelete)
)
View Source
const (
	// DcpOpenFlagProducer indicates this connection wants the other end to be a producer.
	DcpOpenFlagProducer = DcpOpenFlag(0x01)

	// DcpOpenFlagNotifier indicates this connection wants the other end to be a notifier.
	DcpOpenFlagNotifier = DcpOpenFlag(0x02)

	// DcpOpenFlagIncludeXattrs indicates the client wishes to receive extended attributes.
	DcpOpenFlagIncludeXattrs = DcpOpenFlag(0x04)

	// DcpOpenFlagNoValue indicates the client does not wish to receive mutation values.
	DcpOpenFlagNoValue = DcpOpenFlag(0x08)
)
View Source
const (
	//DcpStreamAddFlagDiskOnly indicates that stream should only send items if they are on disk
	DcpStreamAddFlagDiskOnly = DcpStreamAddFlag(0x02)

	// DcpStreamAddFlagLatest indicates this stream wants to get data up to the latest seqno.
	DcpStreamAddFlagLatest = DcpStreamAddFlag(0x04)

	// DcpStreamAddFlagActiveOnly indicates this stream should only connect to an active vbucket.
	DcpStreamAddFlagActiveOnly = DcpStreamAddFlag(0x10)

	// DcpStreamAddFlagStrictVBUUID indicates the vbuuid must match unless the start seqno
	// is 0 and the vbuuid is also 0.
	DcpStreamAddFlagStrictVBUUID = DcpStreamAddFlag(0x20)
)
View Source
const (
	// DatatypeFlagJson indicates the server believes the value payload to be JSON.
	DatatypeFlagJson = DatatypeFlag(0x01)

	// DatatypeFlagCompressed indicates the value payload is compressed.
	DatatypeFlagCompressed = DatatypeFlag(0x02)

	// DatatypeFlagXattrs indicates the inclusion of xattr data in the value payload.
	DatatypeFlagXattrs = DatatypeFlag(0x04)
)
View Source
const (
	// SubdocFlagNone indicates no special treatment for this operation.
	SubdocFlagNone = SubdocFlag(0x00)

	// SubdocFlagMkDirP indicates that the path should be created if it does not already exist.
	SubdocFlagMkDirP = SubdocFlag(0x01)

	// SubdocFlagXattrPath indicates that the path refers to an Xattr rather than the document body.
	SubdocFlagXattrPath = SubdocFlag(0x04)

	// SubdocFlagExpandMacros indicates that the value portion of any sub-document mutations
	// should be expanded if they contain macros such as ${Mutation.CAS}.
	SubdocFlagExpandMacros = SubdocFlag(0x10)
)
View Source
const (
	// SubdocDocFlagNone indicates no special treatment for this operation.
	SubdocDocFlagNone = SubdocDocFlag(0x00)

	// SubdocDocFlagMkDoc indicates that the document should be created if it does not already exist.
	SubdocDocFlagMkDoc = SubdocDocFlag(0x01)

	// SubdocDocFlagReplaceDoc indices that this operation should be a replace rather than upsert.
	SubdocDocFlagReplaceDoc = SubdocDocFlag(0x02)

	// SubdocDocFlagAccessDeleted indicates that you wish to receive soft-deleted documents.
	// Internal: This should never be used and is not supported.
	SubdocDocFlagAccessDeleted = SubdocDocFlag(0x04)
)
View Source
const (
	// MemdService represents a memcached service.
	MemdService = ServiceType(1)

	// MgmtService represents a management service (typically ns_server).
	MgmtService = ServiceType(2)

	// CapiService represents a CouchAPI service (typically for views).
	CapiService = ServiceType(3)

	// N1qlService represents a N1QL service (typically for query).
	N1qlService = ServiceType(4)

	// FtsService represents a full-text-search service.
	FtsService = ServiceType(5)

	// CbasService represents an analytics service.
	CbasService = ServiceType(6)
)
View Source
const (
	// DcpAgentPriorityLow sets the priority for the dcp stream to low
	DcpAgentPriorityLow = DcpAgentPriority(0)

	// DcpAgentPriorityMed sets the priority for the dcp stream to medium
	DcpAgentPriorityMed = DcpAgentPriority(1)

	// DcpAgentPriorityHigh sets the priority for the dcp stream to high
	DcpAgentPriorityHigh = DcpAgentPriority(2)
)

Variables

View Source
var (
	// ErrNoAuthMethod occurs when the server does not support any of the
	// authentication methods that the client finds suitable.
	ErrNoAuthMethod = errors.New("no supported auth")

	// ErrDispatchFail occurs when the request router fails to dispatch an operation
	ErrDispatchFail = errors.New("failed to dispatch operation")

	// ErrBadHosts occurs when the list of hosts specified cannot be contacted.
	ErrBadHosts = errors.New("failed to connect to any of the specified hosts")

	// ErrProtocol occurs when the server responds with unexpected or unparseable data.
	ErrProtocol = errors.New("failed to parse server response")

	// ErrNoReplicas occurs when no replicas respond in time
	ErrNoReplicas = errors.New("no replicas responded in time")

	// ErrNoServer occurs when no server is available to service a keys vbucket.
	ErrNoServer = errors.New("no server available for this vbucket")

	// ErrInvalidServer occurs when an explicit, but invalid server index is specified.
	ErrInvalidServer = errors.New("specific server index is invalid")

	// ErrInvalidVBucket occurs when an explicit, but invalid vbucket index is specified.
	ErrInvalidVBucket = errors.New("specific vbucket index is invalid")

	// ErrInvalidReplica occurs when an explicit, but invalid replica index is specified.
	ErrInvalidReplica = errors.New("specific server index is invalid")

	// ErrInvalidCert occurs when a certificate that is not useable is passed to an Agent.
	ErrInvalidCert = errors.New("certificate is invalid")

	// ErrCliInternalError indicates an internal error occurred within the client.
	ErrCliInternalError = errors.New("client internal error")

	// ErrCancelled occurs when an operation has been cancelled by the user.
	ErrCancelled = errors.New("Operation was cancelled by the user.")

	// ErrInvalidCredentials is returned when an invalid set of credentials is provided for a service.
	ErrInvalidCredentials = errors.New("An invalid set of credentials was provided.")

	// ErrInvalidService occurs when an invalid service is specified for an operation.
	ErrInvalidService = errors.New("Invalid service specified")

	// ErrNoMgmtService occurs when no mgmt services are available for a request.
	ErrNoMgmtService = errors.New("No available management nodes.")

	// ErrNoCapiService occurs when no capi services are available for a request.
	ErrNoCapiService = errors.New("No available capi nodes.")

	// ErrNoN1qlService occurs when no N1QL services are available for a request.
	ErrNoN1qlService = errors.New("No available n1ql nodes.")

	// ErrNoFtsService occurs when no FTS services are available for a request.
	ErrNoFtsService = errors.New("No available fts nodes.")

	// ErrNoCbasService occurs when no CBAS services are available for a request.
	ErrNoCbasService = errors.New("No available cbas nodes.")

	// ErrNonZeroCas occurs when an operation that require a CAS value of 0 is used with a non-zero value.
	ErrNonZeroCas = errors.New("Cas value must be 0.")

	// ErrUnsupportedStatsTarget occurs when a stats operation is performed with an unsupported Target.
	ErrUnsupportedStatsTarget = errors.New("Must specify a supported StatsTarget.")

	// ErrShutdown occurs when operations are performed on a previously closed Agent.
	ErrShutdown = &shutdownError{}

	// ErrOverload occurs when too many operations are dispatched and all queues are full.
	ErrOverload = &overloadError{}

	// ErrNetwork occurs when network failures prevent an operation from succeeding.
	ErrNetwork = &networkError{}

	// ErrTimeout occurs when an operation does not receive a response in a timely manner.
	ErrTimeout = &timeoutError{}

	// ErrStreamClosed occurs when a DCP stream is closed gracefully.
	ErrStreamClosed = &streamEndError{streamEndClosed}

	// ErrStreamStateChanged occurs when a DCP stream is interrupted by failover.
	ErrStreamStateChanged = &streamEndError{streamEndStateChanged}

	// ErrStreamDisconnected occurs when a DCP stream is disconnected.
	ErrStreamDisconnected = &streamEndError{streamEndDisconnected}

	// ErrStreamTooSlow occurs when a DCP stream is cancelled due to the application
	// not keeping up with the rate of flow of DCP events sent by the server.
	ErrStreamTooSlow = &streamEndError{streamEndTooSlow}

	// ErrKeyNotFound occurs when an operation is performed on a key that does not exist.
	ErrKeyNotFound = newSimpleError(StatusKeyNotFound)

	// ErrKeyExists occurs when an operation is performed on a key that could not be found.
	ErrKeyExists = newSimpleError(StatusKeyExists)

	// ErrTooBig occurs when an operation attempts to store more data in a single document
	// than the server is capable of storing (by default, this is a 20MB limit).
	ErrTooBig = newSimpleError(StatusTooBig)

	// ErrInvalidArgs occurs when the server receives invalid arguments for an operation.
	ErrInvalidArgs = newSimpleError(StatusInvalidArgs)

	// ErrNotStored occurs when the server fails to store a key.
	ErrNotStored = newSimpleError(StatusNotStored)

	// ErrBadDelta occurs when an invalid delta value is specified to a counter operation.
	ErrBadDelta = newSimpleError(StatusBadDelta)

	// ErrNotMyVBucket occurs when an operation is dispatched to a server which is
	// non-authoritative for a specific vbucket.
	ErrNotMyVBucket = newSimpleError(StatusNotMyVBucket)

	// ErrNoBucket occurs when no bucket was selected on a connection.
	ErrNoBucket = newSimpleError(StatusNoBucket)

	// ErrAuthStale occurs when authentication credentials have become invalidated.
	ErrAuthStale = newSimpleError(StatusAuthStale)

	// ErrAuthError occurs when the authentication information provided was not valid.
	ErrAuthError = newSimpleError(StatusAuthError)

	// ErrAuthContinue occurs in multi-step authentication when more authentication
	// work needs to be performed in order to complete the authentication process.
	ErrAuthContinue = newSimpleError(StatusAuthContinue)

	// ErrRangeError occurs when the range specified to the server is not valid.
	ErrRangeError = newSimpleError(StatusRangeError)

	// ErrRollback occurs when a DCP stream fails to open due to a rollback having
	// previously occurred since the last time the stream was opened.
	ErrRollback = newSimpleError(StatusRollback)

	// ErrAccessError occurs when an access error occurs.
	ErrAccessError = newSimpleError(StatusAccessError)

	// ErrNotInitialized is sent by servers which are still initializing, and are not
	// yet ready to accept operations on behalf of a particular bucket.
	ErrNotInitialized = newSimpleError(StatusNotInitialized)

	// ErrUnknownCommand occurs when an unknown operation is sent to a server.
	ErrUnknownCommand = newSimpleError(StatusUnknownCommand)

	// ErrOutOfMemory occurs when the server cannot service a request due to memory
	// limitations.
	ErrOutOfMemory = newSimpleError(StatusOutOfMemory)

	// ErrNotSupported occurs when an operation is understood by the server, but that
	// operation is not supported on this server (occurs for a variety of reasons).
	ErrNotSupported = newSimpleError(StatusNotSupported)

	// ErrInternalError occurs when internal errors prevent the server from processing
	// your request.
	ErrInternalError = newSimpleError(StatusInternalError)

	// ErrBusy occurs when the server is too busy to process your request right away.
	// Attempting the operation at a later time will likely succeed.
	ErrBusy = newSimpleError(StatusBusy)

	// ErrTmpFail occurs when a temporary failure is preventing the server from
	// processing your request.
	ErrTmpFail = newSimpleError(StatusTmpFail)

	// ErrSubDocPathNotFound occurs when a sub-document operation targets a path
	// which does not exist in the specifie document.
	ErrSubDocPathNotFound = newSimpleError(StatusSubDocPathNotFound)

	// ErrSubDocPathMismatch occurs when a sub-document operation specifies a path
	// which does not match the document structure (field access on an array).
	ErrSubDocPathMismatch = newSimpleError(StatusSubDocPathMismatch)

	// ErrSubDocPathInvalid occurs when a sub-document path could not be parsed.
	ErrSubDocPathInvalid = newSimpleError(StatusSubDocPathInvalid)

	// ErrSubDocPathTooBig occurs when a sub-document path is too big.
	ErrSubDocPathTooBig = newSimpleError(StatusSubDocPathTooBig)

	// ErrSubDocDocTooDeep occurs when an operation would cause a document to be
	// nested beyond the depth limits allowed by the sub-document specification.
	ErrSubDocDocTooDeep = newSimpleError(StatusSubDocDocTooDeep)

	// ErrSubDocCantInsert occurs when a sub-document operation could not insert.
	ErrSubDocCantInsert = newSimpleError(StatusSubDocCantInsert)

	// ErrSubDocNotJson occurs when a sub-document operation is performed on a
	// document which is not JSON.
	ErrSubDocNotJson = newSimpleError(StatusSubDocNotJson)

	// ErrSubDocBadRange occurs when a sub-document operation is performed with
	// a bad range.
	ErrSubDocBadRange = newSimpleError(StatusSubDocBadRange)

	// ErrSubDocBadDelta occurs when a sub-document counter operation is performed
	// and the specified delta is not valid.
	ErrSubDocBadDelta = newSimpleError(StatusSubDocBadDelta)

	// ErrSubDocPathExists occurs when a sub-document operation expects a path not
	// to exists, but the path was found in the document.
	ErrSubDocPathExists = newSimpleError(StatusSubDocPathExists)

	// ErrSubDocValueTooDeep occurs when a sub-document operation specifies a value
	// which is deeper than the depth limits of the sub-document specification.
	ErrSubDocValueTooDeep = newSimpleError(StatusSubDocValueTooDeep)

	// ErrSubDocBadCombo occurs when a multi-operation sub-document operation is
	// performed and operations within the package of ops conflict with each other.
	ErrSubDocBadCombo = newSimpleError(StatusSubDocBadCombo)

	// ErrSubDocBadMulti occurs when a multi-operation sub-document operation is
	// performed and operations within the package of ops conflict with each other.
	ErrSubDocBadMulti = newSimpleError(StatusSubDocBadMulti)

	// ErrSubDocSuccessDeleted occurs when a multi-operation sub-document operation
	// is performed on a soft-deleted document.
	ErrSubDocSuccessDeleted = newSimpleError(StatusSubDocSuccessDeleted)

	// ErrSubDocXattrInvalidFlagCombo occurs when an invalid set of
	// extended-attribute flags is passed to a sub-document operation.
	ErrSubDocXattrInvalidFlagCombo = newSimpleError(StatusSubDocXattrInvalidFlagCombo)

	// ErrSubDocXattrInvalidKeyCombo occurs when an invalid set of key operations
	// are specified for a extended-attribute sub-document operation.
	ErrSubDocXattrInvalidKeyCombo = newSimpleError(StatusSubDocXattrInvalidKeyCombo)

	// ErrSubDocXattrUnknownMacro occurs when an invalid macro value is specified.
	ErrSubDocXattrUnknownMacro = newSimpleError(StatusSubDocXattrUnknownMacro)

	// ErrSubDocXattrUnknownVAttr occurs when an invalid virtual attribute is specified.
	ErrSubDocXattrUnknownVAttr = newSimpleError(StatusSubDocXattrUnknownVAttr)

	// ErrSubDocXattrCannotModifyVAttr occurs when a mutation is attempted upon
	// a virtual attribute (which are immutable by definition).
	ErrSubDocXattrCannotModifyVAttr = newSimpleError(StatusSubDocXattrCannotModifyVAttr)

	// ErrSubDocMultiPathFailureDeleted occurs when a Multi Path Failure occurs on
	// a soft-deleted document.
	ErrSubDocMultiPathFailureDeleted = newSimpleError(StatusSubDocMultiPathFailureDeleted)
)

Functions

func AcquireTimer

func AcquireTimer(d time.Duration) *time.Timer

AcquireTimer acquires a time from a global pool of timers maintained by the library.

func DecodeCommonFlags

func DecodeCommonFlags(flags uint32) (DataType, CompressionType)

DecodeCommonFlags decodes a flags value into a data type and compression type using the common flags specification.

func EncodeCommonFlags

func EncodeCommonFlags(valueType DataType, compression CompressionType) uint32

EncodeCommonFlags encodes a data type and compression type into a flags value using the common flags specification.

func ErrorCause

func ErrorCause(err error) error

ErrorCause returns an error object representing the underlying cause for an error (without detailed information).

func IsErrorStatus

func IsErrorStatus(err error, code StatusCode) bool

IsErrorStatus is a helper function which allows you to quickly check if a particular error object corresponds with a specific memcached status code in a single operation.

func ReleaseTimer

func ReleaseTimer(t *time.Timer, wasRead bool)

ReleaseTimer returns a timer to the global pool of timers maintained by the library.

func SaslAuthBest

func SaslAuthBest(username, password string, client AuthClient, deadline time.Time) error

SaslAuthBest performs SASL authentication against an AuthClient using the best supported authentication algorithm available on both client and server.

func SaslAuthPlain

func SaslAuthPlain(username, password string, client AuthClient, deadline time.Time) error

SaslAuthPlain performs PLAIN SASL authentication against an AuthClient.

func SaslAuthScramSha1

func SaslAuthScramSha1(username, password string, client AuthClient, deadline time.Time) error

SaslAuthScramSha1 performs SCRAM-SHA1 SASL authentication against an AuthClient.

func SaslAuthScramSha256

func SaslAuthScramSha256(username, password string, client AuthClient, deadline time.Time) error

SaslAuthScramSha256 performs SCRAM-SHA256 SASL authentication against an AuthClient.

func SaslAuthScramSha512

func SaslAuthScramSha512(username, password string, client AuthClient, deadline time.Time) error

SaslAuthScramSha512 performs SCRAM-SHA512 SASL authentication against an AuthClient.

func SetLogRedactionLevel

func SetLogRedactionLevel(level LogRedactLevel)

SetLogRedactionLevel specifies the level with which logs should be redacted.

func SetLogger

func SetLogger(logger Logger)

SetLogger sets a logger to be used by the library. A logger can be obtained via the DefaultStdioLogger() or VerboseStdioLogger() functions. You can also implement your own logger using the Logger interface.

func Version

func Version() string

Version returns a string representation of the current SDK version.

Types

type AddOptions

type AddOptions struct {
	Key          []byte
	Value        []byte
	Flags        uint32
	Datatype     uint8
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

AddOptions encapsulates the parameters for a AddEx operation.

type AdjoinExCallback

type AdjoinExCallback func(*AdjoinResult, error)

AdjoinExCallback is invoked upon completion of a AppendEx or PrependEx operation.

type AdjoinOptions

type AdjoinOptions struct {
	Key          []byte
	Value        []byte
	TraceContext opentracing.SpanContext
}

AdjoinOptions encapsulates the parameters for a AppendEx or PrependEx operation.

type AdjoinResult

type AdjoinResult struct {
	Cas           Cas
	MutationToken MutationToken
}

AdjoinResult encapsulates the result of a AppendEx or PrependEx operation.

type Agent

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

Agent represents the base client handling connections to a Couchbase Server. This is used internally by the higher level classes for communicating with the cluster, it can also be used to perform more advanced operations with a cluster.

func CreateAgent

func CreateAgent(configIn *AgentConfig) (*Agent, error)

CreateAgent creates an agent for performing normal operations.

func CreateDcpAgent

func CreateDcpAgent(configIn *AgentConfig, dcpStreamName string, openFlags DcpOpenFlag) (*Agent, error)

CreateDcpAgent creates an agent for performing DCP operations.

func (*Agent) Add

func (agent *Agent) Add(key, value []byte, flags uint32, expiry uint32, cb StoreCallback) (PendingOp, error)

Add stores a document as long as it does not already exist. DEPRECATED: See AddEx

func (*Agent) AddEx

func (agent *Agent) AddEx(opts AddOptions, cb StoreExCallback) (PendingOp, error)

AddEx stores a document as long as it does not already exist.

func (*Agent) AddIn

func (agent *Agent) AddIn(key []byte, path string, value []byte, flags SubdocFlag, cas Cas, expiry uint32, cb StoreInCallback) (PendingOp, error)

AddIn adds a value at the path within a document. This method works like SetIn, but only only succeeds if the path does not currently exist. DEPRECATED: See AddInEx

func (*Agent) AddInEx

func (agent *Agent) AddInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

AddInEx adds a value at the path within a document. This method works like SetIn, but only only succeeds if the path does not currently exist.

func (*Agent) AddUniqueIn

func (agent *Agent) AddUniqueIn(key []byte, path string, value []byte, flags SubdocFlag, cas Cas, expiry uint32, cb StoreInCallback) (PendingOp, error)

AddUniqueIn adds an entry to an array at a path but only if the value doesn't already exist in the array. DEPRECATED: See AddUniqueInEx

func (*Agent) AddUniqueInEx

func (agent *Agent) AddUniqueInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

AddUniqueInEx adds an entry to an array at a path but only if the value doesn't already exist in the array.

func (*Agent) Append

func (agent *Agent) Append(key, value []byte, cb StoreCallback) (PendingOp, error)

Append appends some bytes to a document. DEPRECATED: See AppendEx

func (*Agent) AppendEx

func (agent *Agent) AppendEx(opts AdjoinOptions, cb AdjoinExCallback) (PendingOp, error)

AppendEx appends some bytes to a document.

func (*Agent) ArrayInsertIn

func (agent *Agent) ArrayInsertIn(key []byte, path string, value []byte, cas Cas, expiry uint32, flags SubdocFlag, cb StoreInCallback) (PendingOp, error)

ArrayInsertIn inserts an entry to an array at a path within the document. DEPRECATED: See ArrayInsertInEx

func (*Agent) ArrayInsertInEx

func (agent *Agent) ArrayInsertInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

ArrayInsertInEx inserts an entry to an array at a path within the document.

func (*Agent) BucketUUID

func (agent *Agent) BucketUUID() string

BucketUUID returns the UUID of the bucket we are connected to.

func (*Agent) CapiEps

func (agent *Agent) CapiEps() []string

CapiEps returns all the available endpoints for performing map-reduce queries.

func (*Agent) CbasEps

func (agent *Agent) CbasEps() []string

CbasEps returns all the available endpoints for performing CBAS queries.

func (*Agent) ClientId

func (agent *Agent) ClientId() string

ClientId returns the unique id for this agent

func (*Agent) Close

func (agent *Agent) Close() error

Close shuts down the agent, disconnecting from all servers and failing any outstanding operations with ErrShutdown.

func (*Agent) CloseStream

func (agent *Agent) CloseStream(vbId uint16, cb CloseStreamCallback) (PendingOp, error)

CloseStream shuts down an open stream for the specified VBucket.

func (*Agent) CounterIn

func (agent *Agent) CounterIn(key []byte, path string, value []byte, cas Cas, expiry uint32, flags SubdocFlag, cb CounterInCallback) (PendingOp, error)

CounterIn performs an arithmetic add or subtract on a value at a path in the document. DEPRECATED: See CounterInEx

func (*Agent) CounterInEx

func (agent *Agent) CounterInEx(opts CounterInOptions, cb CounterInExCallback) (PendingOp, error)

CounterInEx performs an arithmetic add or subtract on a value at a path in the document.

func (*Agent) Decrement

func (agent *Agent) Decrement(key []byte, delta, initial uint64, expiry uint32, cb CounterCallback) (PendingOp, error)

Decrement decrements the unsigned integer value in a document. DEPRECATED: See DecrementEx

func (*Agent) DecrementEx

func (agent *Agent) DecrementEx(opts CounterOptions, cb CounterExCallback) (PendingOp, error)

DecrementEx decrements the unsigned integer value in a document.

func (*Agent) DeleteEx

func (agent *Agent) DeleteEx(opts DeleteOptions, cb DeleteExCallback) (PendingOp, error)

DeleteEx removes a document.

func (*Agent) DeleteInEx

func (agent *Agent) DeleteInEx(opts DeleteInOptions, cb DeleteInExCallback) (PendingOp, error)

DeleteInEx removes the value at a path within the document.

func (*Agent) DeleteMeta

func (agent *Agent) DeleteMeta(key, value, extra []byte, datatype uint8, options, flags, expiry uint32, cas, revNo uint64, cb RemoveCallback) (PendingOp, error)

DeleteMeta deletes a document along with setting some internal Couchbase meta-data. DEPRECATED: See DeleteMetaEx

func (*Agent) DeleteMetaEx

func (agent *Agent) DeleteMetaEx(opts DeleteMetaOptions, cb DeleteMetaExCallback) (PendingOp, error)

DeleteMetaEx deletes a document along with setting some internal Couchbase meta-data.

func (*Agent) Diagnostics

func (agent *Agent) Diagnostics() (*DiagnosticInfo, error)

Diagnostics returns diagnostics information about the client. Mainly containing a list of open connections and their current states.

func (*Agent) DoHttpRequest

func (agent *Agent) DoHttpRequest(req *HttpRequest) (*HttpResponse, error)

DoHttpRequest will perform an HTTP request against one of the HTTP services which are available within the SDK.

func (*Agent) ExistsIn

func (agent *Agent) ExistsIn(key []byte, path string, flags SubdocFlag, cb ExistsInCallback) (PendingOp, error)

ExistsIn returns whether a particular path exists within a document. DEPRECATED: See ExistsInEx

func (*Agent) ExistsInEx

func (agent *Agent) ExistsInEx(opts ExistsInOptions, cb ExistsInExCallback) (PendingOp, error)

ExistsInEx returns whether a particular path exists within a document.

func (*Agent) FtsEps

func (agent *Agent) FtsEps() []string

FtsEps returns all the available endpoints for performing FTS queries.

func (*Agent) Get

func (agent *Agent) Get(key []byte, cb GetCallback) (PendingOp, error)

Get retrieves a document. DEPRECATED: See GetEx

func (*Agent) GetAndLock

func (agent *Agent) GetAndLock(key []byte, lockTime uint32, cb GetCallback) (PendingOp, error)

GetAndLock retrieves a document and locks it. DEPRECATED: See GetAndLockEx

func (*Agent) GetAndLockEx

func (agent *Agent) GetAndLockEx(opts GetAndLockOptions, cb GetAndLockExCallback) (PendingOp, error)

GetAndLockEx retrieves a document and locks it.

func (*Agent) GetAndTouch

func (agent *Agent) GetAndTouch(key []byte, expiry uint32, cb GetCallback) (PendingOp, error)

GetAndTouch retrieves a document and updates its expiry. DEPRECATED: See GetAndTouchEx

func (*Agent) GetAndTouchEx

func (agent *Agent) GetAndTouchEx(opts GetAndTouchOptions, cb GetAndTouchExCallback) (PendingOp, error)

GetAndTouchEx retrieves a document and updates its expiry.

func (*Agent) GetEx

func (agent *Agent) GetEx(opts GetOptions, cb GetExCallback) (PendingOp, error)

GetEx retrieves a document.

func (*Agent) GetFailoverLog

func (agent *Agent) GetFailoverLog(vbId uint16, cb GetFailoverLogCallback) (PendingOp, error)

GetFailoverLog retrieves the fail-over log for a particular VBucket. This is used to resume an interrupted stream after a node fail-over has occurred.

func (*Agent) GetIn

func (agent *Agent) GetIn(key []byte, path string, flags SubdocFlag, cb GetInCallback) (PendingOp, error)

GetIn retrieves the value at a particular path within a JSON document. DEPRECATED: See GetInEx

func (*Agent) GetInEx

func (agent *Agent) GetInEx(opts GetInOptions, cb GetInExCallback) (PendingOp, error)

GetInEx retrieves the value at a particular path within a JSON document.

func (*Agent) GetMeta

func (agent *Agent) GetMeta(key []byte, cb GetMetaCallback) (PendingOp, error)

GetMeta retrieves a document along with some internal Couchbase meta-data. DEPRECATED: See GetMetaEx

func (*Agent) GetMetaEx

func (agent *Agent) GetMetaEx(opts GetMetaOptions, cb GetMetaExCallback) (PendingOp, error)

GetMetaEx retrieves a document along with some internal Couchbase meta-data.

func (*Agent) GetRandom

func (agent *Agent) GetRandom(cb GetRandomCallback) (PendingOp, error)

GetRandom retrieves the key and value of a random document stored within Couchbase Server DEPRECATED: See GetRandomEx.

func (*Agent) GetRandomEx

func (agent *Agent) GetRandomEx(opts GetRandomOptions, cb GetRandomExCallback) (PendingOp, error)

GetRandomEx retrieves the key and value of a random document stored within Couchbase Server.

func (*Agent) GetReplica

func (agent *Agent) GetReplica(key []byte, replicaIdx int, cb GetCallback) (PendingOp, error)

GetReplica retrieves a document from a replica server. DEPRECATED: See GetReplicaEx

func (*Agent) GetReplicaEx

func (agent *Agent) GetReplicaEx(opts GetReplicaOptions, cb GetReplicaExCallback) (PendingOp, error)

GetReplicaEx retrieves a document from a replica server.

func (*Agent) GetVbucketSeqnos

func (agent *Agent) GetVbucketSeqnos(serverIdx int, state VbucketState, cb GetVBucketSeqnosCallback) (PendingOp, error)

GetVbucketSeqnos returns the last checkpoint for a particular VBucket. This is useful for starting a DCP stream from wherever the server currently is.

func (*Agent) HttpClient

func (agent *Agent) HttpClient() *http.Client

HttpClient returns a pre-configured HTTP Client for communicating with Couchbase Server. You must still specify authentication information for any dispatched requests.

func (*Agent) Increment

func (agent *Agent) Increment(key []byte, delta, initial uint64, expiry uint32, cb CounterCallback) (PendingOp, error)

Increment increments the unsigned integer value in a document. DEPRECATED: See IncrementEx

func (*Agent) IncrementEx

func (agent *Agent) IncrementEx(opts CounterOptions, cb CounterExCallback) (PendingOp, error)

IncrementEx increments the unsigned integer value in a document.

func (*Agent) IsSecure

func (agent *Agent) IsSecure() bool

IsSecure returns whether this client is connected via SSL.

func (*Agent) KeyToServer

func (agent *Agent) KeyToServer(key []byte, replicaIdx uint32) int

KeyToServer translates a particular key to its assigned server index.

func (*Agent) KeyToVbucket

func (agent *Agent) KeyToVbucket(key []byte) uint16

KeyToVbucket translates a particular key to its assigned vbucket.

func (*Agent) LookupInEx

func (agent *Agent) LookupInEx(opts LookupInOptions, cb LookupInExCallback) (PendingOp, error)

LookupInEx performs a multiple-lookup sub-document operation on a document.

func (*Agent) MgmtEps

func (agent *Agent) MgmtEps() []string

MgmtEps returns all the available endpoints for performing management queries.

func (*Agent) MutateInEx

func (agent *Agent) MutateInEx(opts MutateInOptions, cb MutateInExCallback) (PendingOp, error)

MutateInEx performs a multiple-mutation sub-document operation on a document.

func (*Agent) N1qlEps

func (agent *Agent) N1qlEps() []string

N1qlEps returns all the available endpoints for performing N1QL queries.

func (*Agent) NumReplicas

func (agent *Agent) NumReplicas() int

NumReplicas returns the number of replicas configured on the connected cluster.

func (*Agent) NumServers

func (agent *Agent) NumServers() int

NumServers returns the number of servers accessible for K/V.

func (*Agent) NumVbuckets

func (agent *Agent) NumVbuckets() int

NumVbuckets returns the number of VBuckets configured on the connected cluster.

func (*Agent) Observe

func (agent *Agent) Observe(key []byte, replicaIdx int, cb ObserveCallback) (PendingOp, error)

Observe retrieves the current CAS and persistence state for a document. DEPRECATED: See ObserveEx

func (*Agent) ObserveEx

func (agent *Agent) ObserveEx(opts ObserveOptions, cb ObserveExCallback) (PendingOp, error)

ObserveEx retrieves the current CAS and persistence state for a document.

func (*Agent) ObserveSeqNo

func (agent *Agent) ObserveSeqNo(key []byte, vbUuid VbUuid, replicaIdx int, cb ObserveSeqNoCallback) (PendingOp, error)

ObserveSeqNo retrieves the persistence state sequence numbers for a particular VBucket. DEPRECATED: See ObserveVbEx

func (*Agent) ObserveSeqNoEx

func (agent *Agent) ObserveSeqNoEx(vbId uint16, vbUuid VbUuid, replicaIdx int, cb ObserveSeqNoExCallback) (PendingOp, error)

ObserveSeqNoEx retrieves the persistence state sequence numbers for a particular VBucket and includes additional details not included by the basic version. DEPRECATED: See ObserveVbEx

func (*Agent) ObserveVbEx

func (agent *Agent) ObserveVbEx(opts ObserveVbOptions, cb ObserveVbExCallback) (PendingOp, error)

ObserveVbEx retrieves the persistence state sequence numbers for a particular VBucket and includes additional details not included by the basic version.

func (*Agent) OpenStream

func (agent *Agent) OpenStream(vbId uint16, flags DcpStreamAddFlag, vbUuid VbUuid, startSeqNo, endSeqNo, snapStartSeqNo, snapEndSeqNo SeqNo, evtHandler StreamObserver, cb OpenStreamCallback) (PendingOp, error)

OpenStream opens a DCP stream for a particular VBucket.

func (*Agent) Ping

func (agent *Agent) Ping(cb PingCallback) (PendingOp, error)

Ping pings all of the servers we are connected to and returns a report regarding the pings that were performed. DEPRECATED: See PingKvEx

func (*Agent) PingKvEx

func (agent *Agent) PingKvEx(opts PingKvOptions, cb PingKvExCallback) (PendingOp, error)

PingKvEx pings all of the servers we are connected to and returns a report regarding the pings that were performed.

func (*Agent) Prepend

func (agent *Agent) Prepend(key, value []byte, cb StoreCallback) (PendingOp, error)

Prepend prepends some bytes to a document. DEPRECATED: See PrependEx

func (*Agent) PrependEx

func (agent *Agent) PrependEx(opts AdjoinOptions, cb AdjoinExCallback) (PendingOp, error)

PrependEx prepends some bytes to a document.

func (*Agent) PushBackIn

func (agent *Agent) PushBackIn(key []byte, path string, value []byte, flags SubdocFlag, cas Cas, expiry uint32, cb StoreInCallback) (PendingOp, error)

PushBackIn pushes an entry to the back of an array at a path within a document. DEPRECATED: See PushBackInEx

func (*Agent) PushBackInEx

func (agent *Agent) PushBackInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

PushBackInEx pushes an entry to the back of an array at a path within a document.

func (*Agent) PushFrontIn

func (agent *Agent) PushFrontIn(key []byte, path string, value []byte, flags SubdocFlag, cas Cas, expiry uint32, cb StoreInCallback) (PendingOp, error)

PushFrontIn pushes an entry to the front of an array at a path within a document. DEPRECATED: See PushFrontInEx

func (*Agent) PushFrontInEx

func (agent *Agent) PushFrontInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

PushFrontInEx pushes an entry to the front of an array at a path within a document.

func (*Agent) Remove

func (agent *Agent) Remove(key []byte, cas Cas, cb RemoveCallback) (PendingOp, error)

Remove removes a document. DEPRECATED: See DeleteEx

func (*Agent) RemoveIn

func (agent *Agent) RemoveIn(key []byte, path string, cas Cas, expiry uint32, flags SubdocFlag, cb RemoveInCallback) (PendingOp, error)

RemoveIn removes the value at a path within the document. DEPRECATED: See DeleteInEx

func (*Agent) Replace

func (agent *Agent) Replace(key, value []byte, flags uint32, cas Cas, expiry uint32, cb StoreCallback) (PendingOp, error)

Replace replaces the value of a Couchbase document with another value. DEPRECATED: See ReplaceEx

func (*Agent) ReplaceEx

func (agent *Agent) ReplaceEx(opts ReplaceOptions, cb StoreExCallback) (PendingOp, error)

ReplaceEx replaces the value of a Couchbase document with another value.

func (*Agent) ReplaceIn

func (agent *Agent) ReplaceIn(key []byte, path string, value []byte, cas Cas, expiry uint32, flags SubdocFlag, cb StoreInCallback) (PendingOp, error)

ReplaceIn replaces the value at the path within a document. This method works like SetIn, but only only succeeds if the path currently exists. DEPRECATED: See ReplaceInEx

func (*Agent) ReplaceInEx

func (agent *Agent) ReplaceInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

ReplaceInEx replaces the value at the path within a document. This method works like SetIn, but only only succeeds if the path currently exists.

func (*Agent) ServerConnectTimeout

func (agent *Agent) ServerConnectTimeout() time.Duration

ServerConnectTimeout gets the timeout for each server connection, including all authentication steps.

func (*Agent) Set

func (agent *Agent) Set(key, value []byte, flags uint32, expiry uint32, cb StoreCallback) (PendingOp, error)

Set stores a document. DEPRECATED: See SetEx

func (*Agent) SetEx

func (agent *Agent) SetEx(opts SetOptions, cb StoreExCallback) (PendingOp, error)

SetEx stores a document.

func (*Agent) SetIn

func (agent *Agent) SetIn(key []byte, path string, value []byte, flags SubdocFlag, cas Cas, expiry uint32, cb StoreInCallback) (PendingOp, error)

SetIn sets the value at a path within a document. DEPRECATED: See SetInEx

func (*Agent) SetInEx

func (agent *Agent) SetInEx(opts StoreInOptions, cb StoreInExCallback) (PendingOp, error)

SetInEx sets the value at a path within a document.

func (*Agent) SetMeta

func (agent *Agent) SetMeta(key, value, extra []byte, datatype uint8, options, flags, expiry uint32, cas, revNo uint64, cb StoreCallback) (PendingOp, error)

SetMeta stores a document along with setting some internal Couchbase meta-data. DEPRECATED: See SetMetaEx

func (*Agent) SetMetaEx

func (agent *Agent) SetMetaEx(opts SetMetaOptions, cb SetMetaExCallback) (PendingOp, error)

SetMetaEx stores a document along with setting some internal Couchbase meta-data.

func (*Agent) SetServerConnectTimeout

func (agent *Agent) SetServerConnectTimeout(timeout time.Duration)

SetServerConnectTimeout sets the timeout for each server connection.

func (*Agent) Stats

func (agent *Agent) Stats(key string, cb ServerStatsCallback) (PendingOp, error)

Stats retrieves statistics information from the server. Note that as this function is an aggregator across numerous servers, there are no guarantees about the consistency of the results. Occasionally, some nodes may not be represented in the results, or there may be conflicting information between multiple nodes (a vbucket active on two separate nodes at once). DEPRECATED: See StatsEx

func (*Agent) StatsEx

func (agent *Agent) StatsEx(opts StatsOptions, cb StatsExCallback) (PendingOp, error)

StatsEx retrieves statistics information from the server. Note that as this function is an aggregator across numerous servers, there are no guarantees about the consistency of the results. Occasionally, some nodes may not be represented in the results, or there may be conflicting information between multiple nodes (a vbucket active on two separate nodes at once).

func (*Agent) SubDocLookup

func (agent *Agent) SubDocLookup(key []byte, ops []SubDocOp, flags SubdocDocFlag, cb LookupInCallback) (PendingOp, error)

SubDocLookup performs a multiple-lookup sub-document operation on a document. DEPRECATED: See LookupInEx

func (*Agent) SubDocMutate

func (agent *Agent) SubDocMutate(key []byte, ops []SubDocOp, flags SubdocDocFlag, cas Cas, expiry uint32, cb MutateInCallback) (PendingOp, error)

SubDocMutate performs a multiple-mutation sub-document operation on a document. DEPRECATED: See MutateInEx

func (*Agent) Touch

func (agent *Agent) Touch(key []byte, cas Cas, expiry uint32, cb TouchCallback) (PendingOp, error)

Touch updates the expiry for a document. DEPRECATED: See TouchEx

func (*Agent) TouchEx

func (agent *Agent) TouchEx(opts TouchOptions, cb TouchExCallback) (PendingOp, error)

TouchEx updates the expiry for a document.

func (*Agent) Unlock

func (agent *Agent) Unlock(key []byte, cas Cas, cb UnlockCallback) (PendingOp, error)

Unlock unlocks a locked document. DEPRECATED: See UnlockEx

func (*Agent) UnlockEx

func (agent *Agent) UnlockEx(opts UnlockOptions, cb UnlockExCallback) (PendingOp, error)

UnlockEx unlocks a locked document.

func (*Agent) VbucketToServer

func (agent *Agent) VbucketToServer(vbID uint16, replicaIdx uint32) int

VbucketToServer returns the server index for a particular vbucket.

func (*Agent) VbucketsOnServer

func (agent *Agent) VbucketsOnServer(index int) []uint16

VbucketsOnServer returns the list of VBuckets for a server.

type AgentConfig

type AgentConfig struct {
	UserString           string
	MemdAddrs            []string
	HttpAddrs            []string
	TlsConfig            *tls.Config
	BucketName           string
	NetworkType          string
	AuthHandler          AuthFunc
	Auth                 AuthProvider
	UseMutationTokens    bool
	UseKvErrorMaps       bool
	UseEnhancedErrors    bool
	UseCompression       bool
	UseDurations         bool
	DisableDecompression bool

	CompressionMinSize  int
	CompressionMinRatio float64

	HttpRedialPeriod time.Duration
	HttpRetryDelay   time.Duration
	CccpMaxWait      time.Duration
	CccpPollPeriod   time.Duration

	ConnectTimeout       time.Duration
	ServerConnectTimeout time.Duration
	NmvRetryDelay        time.Duration
	KvPoolSize           int
	MaxQueueSize         int

	HttpMaxIdleConns        int
	HttpMaxIdleConnsPerHost int
	HttpIdleConnTimeout     time.Duration

	Tracer                 opentracing.Tracer
	NoRootTraceSpans       bool
	UseZombieLogger        bool
	ZombieLoggerInterval   time.Duration
	ZombieLoggerSampleSize int

	DcpAgentPriority DcpAgentPriority
	UseDcpExpiry     bool
	DcpBufferSize    int

	// Username specifies the username to use when connecting.
	// DEPRECATED
	Username string

	// Password specifies the password to use when connecting.
	// DEPRECATED
	Password string
}

AgentConfig specifies the configuration options for creation of an Agent.

func (*AgentConfig) FromConnStr

func (config *AgentConfig) FromConnStr(connStr string) error

FromConnStr populates the AgentConfig with information from a Couchbase Connection String. Supported options are:

cacertpath (string) - Path to the CA certificate
certpath (string) - Path to your authentication certificate
keypath (string) - Path to your authentication key
config_total_timeout (int) - Maximum period to attempt to connect to cluster in ms.
config_node_timeout (int) - Maximum period to attempt to connect to a node in ms.
http_redial_period (int) - Maximum period to keep HTTP config connections open in ms.
http_retry_delay (int) - Period to wait between retrying nodes for HTTP config in ms.
config_poll_floor_interval (int) - Minimum time to wait between fetching configs via CCCP in ms.
config_poll_interval (int) - Period to wait between CCCP config polling in ms.
kv_pool_size (int) - The number of connections to establish per node.
max_queue_size (int) - The maximum size of the operation queues per node.
use_kverrmaps (bool) - Whether to enable error maps from the server.
use_enhanced_errors (bool) - Whether to enable enhanced error information.
fetch_mutation_tokens (bool) - Whether to fetch mutation tokens for operations.
compression (bool) - Whether to enable network-wise compression of documents.
compression_min_size (int) - The minimal size of the document to consider compression.
compression_min_ratio (float64) - The minimal compress ratio (compressed / original) for the document to be sent compressed.
server_duration (bool) - Whether to enable fetching server operation durations.
http_max_idle_conns (int) - Maximum number of idle http connections in the pool.
http_max_idle_conns_per_host (int) - Maximum number of idle http connections in the pool per host.
http_idle_conn_timeout (int) - Maximum length of time for an idle connection to stay in the pool in ms.
network (string) - The network type to use

type AuthClient

type AuthClient interface {
	Address() string
	SupportsFeature(feature HelloFeature) bool

	ExecSaslListMechs(deadline time.Time) ([]string, error)
	ExecSaslAuth(k, v []byte, deadline time.Time) ([]byte, error)
	ExecSaslStep(k, v []byte, deadline time.Time) ([]byte, error)
	ExecSelectBucket(b []byte, deadline time.Time) error
}

AuthClient exposes an interface for performing authentication on a connected Couchbase K/V client.

type AuthCredsRequest

type AuthCredsRequest struct {
	Service  ServiceType
	Endpoint string
}

AuthCredsRequest represents an authentication details request from the agent.

type AuthFunc

type AuthFunc func(client AuthClient, deadline time.Time) error

AuthFunc is invoked by the agent to authenticate a client.

type AuthProvider

type AuthProvider interface {
	Credentials(req AuthCredsRequest) ([]UserPassPair, error)
}

AuthProvider is an interface to allow the agent to fetch authentication credentials on-demand from the application.

type Cas

type Cas uint64

Cas represents a unique revision of a document. This can be used to perform optimistic locking.

type CloseStreamCallback

type CloseStreamCallback func(error)

CloseStreamCallback is invoked with the results of `CloseStream` operations.

type CompressionType

type CompressionType uint32

CompressionType indicates the type of compression for a value

type CounterCallback

type CounterCallback func(uint64, Cas, MutationToken, error)

CounterCallback is invoked with the results of `Counter` operations. DEPRECATED

type CounterExCallback

type CounterExCallback func(*CounterResult, error)

CounterExCallback is invoked upon completion of a IncrementEx or DecrementEx operation.

type CounterInCallback

type CounterInCallback func([]byte, Cas, MutationToken, error)

CounterInCallback is invoked with the results of `CounterIn` operations. DEPRECATED

type CounterInExCallback

type CounterInExCallback func(*CounterInResult, error)

CounterInExCallback is invoked upon completion of a CounterInEx operation.

type CounterInOptions

type CounterInOptions StoreInOptions

CounterInOptions encapsulates the parameters for a CounterInEx operation.

type CounterInResult

type CounterInResult struct {
	Value         []byte
	Cas           Cas
	MutationToken MutationToken
}

CounterInResult encapsulates the result of a CounterInEx operation.

type CounterOptions

type CounterOptions struct {
	Key          []byte
	Delta        uint64
	Initial      uint64
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

CounterOptions encapsulates the parameters for a IncrementEx or DecrementEx operation.

type CounterResult

type CounterResult struct {
	Value         uint64
	Cas           Cas
	MutationToken MutationToken
}

CounterResult encapsulates the result of a IncrementEx or DecrementEx operation.

type DataType

type DataType uint32

DataType represents the type of data for a value

type DatatypeFlag

type DatatypeFlag uint8

DatatypeFlag specifies data flags for the value of a document.

type DcpAgentPriority

type DcpAgentPriority uint8

DcpAgentPriority specifies the priority level for a dcp stream

type DcpOpenFlag

type DcpOpenFlag uint32

DcpOpenFlag specifies flags for DCP connections configured when the stream is opened.

type DcpStreamAddFlag

type DcpStreamAddFlag uint32

DcpStreamAddFlag specifies flags for DCP streams configured when the stream is opened.

type DeleteExCallback

type DeleteExCallback func(*DeleteResult, error)

DeleteExCallback is invoked upon completion of a DeleteEx operation.

type DeleteInExCallback

type DeleteInExCallback func(*DeleteInResult, error)

DeleteInExCallback is invoked upon completion of a DeleteInEx operation.

type DeleteInOptions

type DeleteInOptions struct {
	Key          []byte
	Path         string
	Cas          Cas
	Expiry       uint32
	Flags        SubdocFlag
	TraceContext opentracing.SpanContext
}

DeleteInOptions encapsulates the parameters for a DeleteInEx operation.

type DeleteInResult

type DeleteInResult struct {
	Cas           Cas
	MutationToken MutationToken
}

DeleteInResult encapsulates the result of a DeleteInEx operation.

type DeleteMetaExCallback

type DeleteMetaExCallback func(*DeleteMetaResult, error)

DeleteMetaExCallback is invoked upon completion of a DeleteMetaEx operation.

type DeleteMetaOptions

type DeleteMetaOptions struct {
	Key          []byte
	Value        []byte
	Extra        []byte
	Datatype     uint8
	Options      uint32
	Flags        uint32
	Expiry       uint32
	Cas          Cas
	RevNo        uint64
	TraceContext opentracing.SpanContext
}

DeleteMetaOptions encapsulates the parameters for a DeleteMetaEx operation.

type DeleteMetaResult

type DeleteMetaResult struct {
	Cas           Cas
	MutationToken MutationToken
}

DeleteMetaResult encapsulates the result of a DeleteMetaEx operation.

type DeleteOptions

type DeleteOptions struct {
	Key          []byte
	Cas          Cas
	TraceContext opentracing.SpanContext
}

DeleteOptions encapsulates the parameters for a DeleteEx operation.

type DeleteResult

type DeleteResult struct {
	Cas           Cas
	MutationToken MutationToken
}

DeleteResult encapsulates the result of a DeleteEx operation.

type DiagnosticInfo

type DiagnosticInfo struct {
	ConfigRev int64
	MemdConns []MemdConnInfo
}

DiagnosticInfo is returned by the Diagnostics method and includes information about the overall health of the clients connections.

type ExistsInCallback

type ExistsInCallback func(Cas, error)

ExistsInCallback is invoked with the results of `ExistsIn` operations. DEPRECATED

type ExistsInExCallback

type ExistsInExCallback func(*ExistsInResult, error)

ExistsInExCallback is invoked upon completion of a ExistsInEx operation.

type ExistsInOptions

type ExistsInOptions struct {
	Key          []byte
	Path         string
	Flags        SubdocFlag
	TraceContext opentracing.SpanContext
}

ExistsInOptions encapsulates the parameters for a ExistsInEx operation.

type ExistsInResult

type ExistsInResult struct {
	Cas Cas
}

ExistsInResult encapsulates the result of a ExistsInEx operation.

type FailoverEntry

type FailoverEntry struct {
	VbUuid VbUuid
	SeqNo  SeqNo
}

FailoverEntry represents a single entry in the server fail-over log.

type GetAndLockExCallback

type GetAndLockExCallback func(*GetAndLockResult, error)

GetAndLockExCallback is invoked upon completion of a GetAndLockEx operation.

type GetAndLockOptions

type GetAndLockOptions struct {
	Key          []byte
	LockTime     uint32
	TraceContext opentracing.SpanContext
}

GetAndLockOptions encapsulates the parameters for a GetAndLockEx operation.

type GetAndLockResult

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

GetAndLockResult encapsulates the result of a GetAndLockEx operation.

type GetAndTouchExCallback

type GetAndTouchExCallback func(*GetAndTouchResult, error)

GetAndTouchExCallback is invoked upon completion of a GetAndTouchEx operation.

type GetAndTouchOptions

type GetAndTouchOptions struct {
	Key          []byte
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

GetAndTouchOptions encapsulates the parameters for a GetAndTouchEx operation.

type GetAndTouchResult

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

GetAndTouchResult encapsulates the result of a GetAndTouchEx operation.

type GetCallback

type GetCallback func([]byte, uint32, Cas, error)

GetCallback is invoked with the results of `Get` operations. DEPRECATED

type GetExCallback

type GetExCallback func(*GetResult, error)

GetExCallback is invoked upon completion of a GetEx operation.

type GetFailoverLogCallback

type GetFailoverLogCallback func([]FailoverEntry, error)

GetFailoverLogCallback is invoked with the results of `GetFailoverLog` operations.

type GetInCallback

type GetInCallback func([]byte, Cas, error)

GetInCallback is invoked with the results of `GetIn` operations. DEPRECATED

type GetInExCallback

type GetInExCallback func(*GetInResult, error)

GetInExCallback is invoked upon completion of a GetInEx operation.

type GetInOptions

type GetInOptions struct {
	Key          []byte
	Path         string
	Flags        SubdocFlag
	TraceContext opentracing.SpanContext
}

GetInOptions encapsulates the parameters for a GetInEx operation.

type GetInResult

type GetInResult struct {
	Value []byte
	Cas   Cas
}

GetInResult encapsulates the result of a GetInEx operation.

type GetMetaCallback

type GetMetaCallback func([]byte, uint32, Cas, uint32, SeqNo, uint8, uint32, error)

GetMetaCallback is invoked with the results of `GetMeta` operations. DEPRECATED

type GetMetaExCallback

type GetMetaExCallback func(*GetMetaResult, error)

GetMetaExCallback is invoked upon completion of a GetMetaEx operation.

type GetMetaOptions

type GetMetaOptions struct {
	Key          []byte
	TraceContext opentracing.SpanContext
}

GetMetaOptions encapsulates the parameters for a GetMetaEx operation.

type GetMetaResult

type GetMetaResult struct {
	Value    []byte
	Flags    uint32
	Cas      Cas
	Expiry   uint32
	SeqNo    SeqNo
	Datatype uint8
	Deleted  uint32
}

GetMetaResult encapsulates the result of a GetMetaEx operation.

type GetOptions

type GetOptions struct {
	Key          []byte
	TraceContext opentracing.SpanContext
}

GetOptions encapsulates the parameters for a GetEx operation.

type GetRandomCallback

type GetRandomCallback func([]byte, []byte, uint32, Cas, error)

GetRandomCallback is invoked with the results of `GetRandom` operations. DEPRECATED

type GetRandomExCallback

type GetRandomExCallback func(*GetRandomResult, error)

GetRandomExCallback is invoked upon completion of a GetRandomEx operation.

type GetRandomOptions

type GetRandomOptions struct {
	TraceContext opentracing.SpanContext
}

GetRandomOptions encapsulates the parameters for a GetRandomEx operation.

type GetRandomResult

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

GetRandomResult encapsulates the result of a GetRandomEx operation.

type GetReplicaExCallback

type GetReplicaExCallback func(*GetReplicaResult, error)

GetReplicaExCallback is invoked upon completion of a GetReplicaEx operation.

type GetReplicaOptions

type GetReplicaOptions struct {
	Key          []byte
	ReplicaIdx   int
	TraceContext opentracing.SpanContext
}

GetReplicaOptions encapsulates the parameters for a GetReplicaEx operation.

type GetReplicaResult

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

GetReplicaResult encapsulates the result of a GetReplicaEx operation.

type GetResult

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

GetResult encapsulates the result of a GetEx operation.

type GetVBucketSeqnosCallback

type GetVBucketSeqnosCallback func([]VbSeqNoEntry, error)

GetVBucketSeqnosCallback is invoked with the results of `GetVBucketSeqnos` operations.

type HelloFeature

type HelloFeature uint16

HelloFeature represents a feature code included in a memcached HELLO operation.

type HttpRequest

type HttpRequest struct {
	Service  ServiceType
	Method   string
	Endpoint string
	Path     string
	Username string
	Password string
	Body     []byte
}

HttpRequest contains the description of an HTTP request to perform.

type HttpResponse

type HttpResponse struct {
	Endpoint   string
	StatusCode int
	Body       io.ReadCloser
}

HttpResponse encapsulates the response from an HTTP request.

type KeyState

type KeyState uint8

KeyState represents the various storage states of a key on the server.

type KvError

type KvError struct {
	Code        StatusCode
	Name        string
	Description string
	Context     string
	Ref         string
}

KvError wraps key-value errors that occur within the SDK.

func (KvError) AccessError deprecated

func (e KvError) AccessError() bool

AccessError checks for the StatusAccessError status code.

Deprecated: This API should no longer be relied on.

func (KvError) AuthContinue deprecated

func (e KvError) AuthContinue() bool

AuthContinue checks for the StatusAuthContinue status code.

Deprecated: This API should no longer be relied on.

func (KvError) AuthError deprecated

func (e KvError) AuthError() bool

AuthError checks for the StatusAuthError status code.

Deprecated: This API should no longer be relied on.

func (KvError) AuthStale deprecated

func (e KvError) AuthStale() bool

AuthStale checks for the StatusAuthStale status code.

Deprecated: This API should no longer be relied on.

func (KvError) BadDelta deprecated

func (e KvError) BadDelta() bool

BadDelta checks for the StatusBadDelta status code.

Deprecated: This API should no longer be relied on.

func (KvError) BusyError deprecated

func (e KvError) BusyError() bool

BusyError checks for the StatusBusy status code.

Deprecated: This API should no longer be relied on.

func (KvError) Error

func (e KvError) Error() string

Error returns the string representation of a kv error.

func (KvError) InternalError deprecated

func (e KvError) InternalError() bool

InternalError checks for the StatusInternalError status code.

Deprecated: This API should no longer be relied on.

func (KvError) KeyExists deprecated

func (e KvError) KeyExists() bool

KeyExists checks for the StatusKeyExists status code.

Deprecated: This API should no longer be relied on.

func (KvError) KeyNotFound deprecated

func (e KvError) KeyNotFound() bool

KeyNotFound checks for the StatusKeyNotFound status code.

Deprecated: This API should no longer be relied on.

func (KvError) NoBucket deprecated

func (e KvError) NoBucket() bool

NoBucket checks for the StatusNoBucket status code.

Deprecated: This API should no longer be relied on.

func (KvError) NotIntializedError deprecated

func (e KvError) NotIntializedError() bool

NotIntializedError checks for the StatusNotInitialized status code.

Deprecated: This API should no longer be relied on.

func (KvError) NotMyVBucket deprecated

func (e KvError) NotMyVBucket() bool

NotMyVBucket checks for the StatusNotMyVBucket status code.

Deprecated: This API should no longer be relied on.

func (KvError) NotStored deprecated

func (e KvError) NotStored() bool

NotStored checks for the StatusNotStored status code.

Deprecated: This API should no longer be relied on.

func (KvError) NotSupportedError deprecated

func (e KvError) NotSupportedError() bool

NotSupportedError checks for the StatusNotSupported status code.

Deprecated: This API should no longer be relied on.

func (KvError) RangeError deprecated

func (e KvError) RangeError() bool

RangeError checks for the StatusRangeError status code.

Deprecated: This API should no longer be relied on.

func (KvError) Rollback deprecated

func (e KvError) Rollback() bool

Rollback checks for the StatusRollback status code.

Deprecated: This API should no longer be relied on.

func (KvError) Success deprecated

func (e KvError) Success() bool

Success is a method to check if the error represents a successful operation.

Deprecated: This API should no longer be relied on.

func (KvError) Temporary

func (e KvError) Temporary() bool

Temporary indicates whether this error is known to be temporary, and that attempting the operation again after a short delay should succeed.

func (KvError) UnknownCommandError deprecated

func (e KvError) UnknownCommandError() bool

UnknownCommandError checks for the StatusUnknownCommand status code.

Deprecated: This API should no longer be relied on.

func (KvError) ValueTooBig deprecated

func (e KvError) ValueTooBig() bool

ValueTooBig checks for the StatusTooBig status code.

Deprecated: This API should no longer be relied on.

type LogLevel

type LogLevel int

LogLevel specifies the severity of a log message.

const (
	LogError LogLevel = iota
	LogWarn
	LogInfo
	LogDebug
	LogTrace
	LogSched
	LogMaxVerbosity
)

Various logging levels (or subsystems) which can categorize the message. Currently these are ordered in decreasing severity.

type LogRedactLevel

type LogRedactLevel int

LogRedactLevel specifies the degree with which to redact the logs.

const (
	// RedactNone indicates to perform no redactions
	RedactNone LogRedactLevel = iota

	// RedactPartial indicates to redact all possible user-identifying information from logs.
	RedactPartial

	// RedactFull indicates to fully redact all possible identifying information from logs.
	RedactFull
)

type Logger

type Logger interface {
	// Outputs logging information:
	// level is the verbosity level
	// offset is the position within the calling stack from which the message
	// originated. This is useful for contextual loggers which retrieve file/line
	// information.
	Log(level LogLevel, offset int, format string, v ...interface{}) error
}

Logger defines a logging interface. You can either use one of the default loggers (DefaultStdioLogger(), VerboseStdioLogger()) or implement your own.

func DefaultStdOutLogger deprecated

func DefaultStdOutLogger() Logger

DefaultStdOutLogger gets the default logger. This actually logs to stderr rather than stdout. Use DefaultStdioLogger which has a correct name, since the "standard" logger logs to stderr, rather than stdout.

Deprecated: Use DefaultStdioLogger() instead.

func DefaultStdioLogger

func DefaultStdioLogger() Logger

DefaultStdioLogger gets the default standard I/O logger.

gocbcore.SetLogger(gocbcore.DefaultStdioLogger())

func VerboseStdioLogger

func VerboseStdioLogger() Logger

VerboseStdioLogger is a more verbose level of DefaultStdioLogger(). Messages pertaining to the scheduling of ordinary commands (and their responses) will also be emitted.

gocbcore.SetLogger(gocbcore.VerboseStdioLogger())

type LookupInCallback

type LookupInCallback func([]SubDocResult, Cas, error)

LookupInCallback is invoked with the results of `LookupIn` operations. DEPRECATED

type LookupInExCallback

type LookupInExCallback func(*LookupInResult, error)

LookupInExCallback is invoked upon completion of a LookupInEx operation.

type LookupInOptions

type LookupInOptions struct {
	Key          []byte
	Flags        SubdocDocFlag
	Ops          []SubDocOp
	TraceContext opentracing.SpanContext
}

LookupInOptions encapsulates the parameters for a LookupInEx operation.

type LookupInResult

type LookupInResult struct {
	Cas Cas
	Ops []SubDocResult
}

LookupInResult encapsulates the result of a LookupInEx operation.

type MemdConnInfo

type MemdConnInfo struct {
	LocalAddr    string
	RemoteAddr   string
	LastActivity time.Time
}

MemdConnInfo represents information we know about a particular memcached connection reported in a diagnostics report.

type MultiError

type MultiError struct {
	Errors []error
}

MultiError encapsulates multiple errors that may be returned by one method.

func (*MultiError) Error

func (e *MultiError) Error() string

type MutateInCallback

type MutateInCallback func([]SubDocResult, Cas, MutationToken, error)

MutateInCallback is invoked with the results of `MutateIn` operations. DEPRECATED

type MutateInExCallback

type MutateInExCallback func(*MutateInResult, error)

MutateInExCallback is invoked upon completion of a MutateInEx operation.

type MutateInOptions

type MutateInOptions struct {
	Key          []byte
	Flags        SubdocDocFlag
	Cas          Cas
	Expiry       uint32
	Ops          []SubDocOp
	TraceContext opentracing.SpanContext
}

MutateInOptions encapsulates the parameters for a MutateInEx operation.

type MutateInResult

type MutateInResult struct {
	Cas           Cas
	MutationToken MutationToken
	Ops           []SubDocResult
}

MutateInResult encapsulates the result of a MutateInEx operation.

type MutationToken

type MutationToken struct {
	VbId   uint16
	VbUuid VbUuid
	SeqNo  SeqNo
}

MutationToken represents a particular mutation within the cluster.

type ObserveCallback

type ObserveCallback func(KeyState, Cas, error)

ObserveCallback is invoked with the results of `Observe` operations. DEPRECATED

type ObserveExCallback

type ObserveExCallback func(*ObserveResult, error)

ObserveExCallback is invoked upon completion of a ObserveEx operation.

type ObserveOptions

type ObserveOptions struct {
	Key          []byte
	ReplicaIdx   int
	TraceContext opentracing.SpanContext
}

ObserveOptions encapsulates the parameters for a ObserveEx operation.

type ObserveResult

type ObserveResult struct {
	KeyState KeyState
	Cas      Cas
}

ObserveResult encapsulates the result of a ObserveEx operation.

type ObserveSeqNoCallback

type ObserveSeqNoCallback func(SeqNo, SeqNo, error)

ObserveSeqNoCallback is invoked with the results of `ObserveSeqNo` operations. DEPRECATED

type ObserveSeqNoExCallback

type ObserveSeqNoExCallback func(*ObserveSeqNoStats, error)

ObserveSeqNoExCallback is invoked with the results of `ObserveSeqNoEx` operations. DEPRECATED

type ObserveSeqNoStats

type ObserveSeqNoStats struct {
	DidFailover  bool
	VbId         uint16
	VbUuid       VbUuid
	PersistSeqNo SeqNo
	CurrentSeqNo SeqNo
	OldVbUuid    VbUuid
	LastSeqNo    SeqNo
}

ObserveSeqNoStats represents the stats returned from an observe operation. DEPRECATED

type ObserveVbExCallback

type ObserveVbExCallback func(*ObserveVbResult, error)

ObserveVbExCallback is invoked upon completion of a ObserveVbEx operation.

type ObserveVbOptions

type ObserveVbOptions struct {
	VbId         uint16
	VbUuid       VbUuid
	ReplicaIdx   int
	TraceContext opentracing.SpanContext
}

ObserveVbOptions encapsulates the parameters for a ObserveVbEx operation.

type ObserveVbResult

type ObserveVbResult struct {
	DidFailover  bool
	VbId         uint16
	VbUuid       VbUuid
	PersistSeqNo SeqNo
	CurrentSeqNo SeqNo
	OldVbUuid    VbUuid
	LastSeqNo    SeqNo
}

ObserveVbResult encapsulates the result of a ObserveVbEx operation.

type OpenStreamCallback

type OpenStreamCallback func([]FailoverEntry, error)

OpenStreamCallback is invoked with the results of `OpenStream` operations.

type PasswordAuthProvider

type PasswordAuthProvider struct {
	Username string
	Password string
}

PasswordAuthProvider provides a standard AuthProvider implementation for use with a standard username/password pair (for example, RBAC).

func (*PasswordAuthProvider) Credentials

func (auth *PasswordAuthProvider) Credentials(req AuthCredsRequest) ([]UserPassPair, error)

Credentials directly returns the username/password from the provider.

type PendingOp

type PendingOp interface {
	Cancel() bool
}

PendingOp represents an outstanding operation within the client. This can be used to cancel an operation before it completes.

type PingCallback

type PingCallback func(services []PingResult)

PingCallback is invoked with the results of a multi-node ping operation. DEPRECATED

type PingKvExCallback

type PingKvExCallback func(*PingKvResult, error)

PingKvExCallback is invoked upon completion of a PingKvEx operation.

type PingKvOptions

type PingKvOptions struct {
	TraceContext opentracing.SpanContext
}

PingKvOptions encapsulates the parameters for a PingKvEx operation.

type PingKvResult

type PingKvResult struct {
	Services []PingResult
}

PingKvResult encapsulates the result of a PingKvEx operation.

type PingResult

type PingResult struct {
	Endpoint string
	Error    error
	Latency  time.Duration
}

PingResult contains the results of a ping to a single server.

type PrependOptions

type PrependOptions struct {
	Key          []byte
	Value        []byte
	TraceContext opentracing.SpanContext
}

PrependOptions encapsulates the parameters for a ReplaceEx operation.

type RemoveCallback

type RemoveCallback func(Cas, MutationToken, error)

RemoveCallback is invoked with the results of `Remove` operations. DEPRECATED

type RemoveInCallback

type RemoveInCallback func(Cas, MutationToken, error)

RemoveInCallback is invoked with the results of `RemoveIn` operations. DEPRECATED

type ReplaceOptions

type ReplaceOptions struct {
	Key          []byte
	Value        []byte
	Flags        uint32
	Datatype     uint8
	Cas          Cas
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

ReplaceOptions encapsulates the parameters for a ReplaceEx operation.

type SeqNo

type SeqNo uint64

SeqNo is a sequential mutation number indicating the order and precise position of a write that has occurred.

type ServerStatsCallback

type ServerStatsCallback func(stats map[string]SingleServerStats)

ServerStatsCallback is invoked with the results of `Stats` operations. DEPRECATED

type ServiceType

type ServiceType int

ServiceType specifies a particular Couchbase service type.

type SetMetaExCallback

type SetMetaExCallback func(*SetMetaResult, error)

SetMetaExCallback is invoked upon completion of a SetMetaEx operation.

type SetMetaOption

type SetMetaOption uint32

SetMetaOption represents possible option values for a SetMeta operation.

type SetMetaOptions

type SetMetaOptions struct {
	Key          []byte
	Value        []byte
	Extra        []byte
	Datatype     uint8
	Options      uint32
	Flags        uint32
	Expiry       uint32
	Cas          Cas
	RevNo        uint64
	TraceContext opentracing.SpanContext
}

SetMetaOptions encapsulates the parameters for a SetMetaEx operation.

type SetMetaResult

type SetMetaResult struct {
	Cas           Cas
	MutationToken MutationToken
}

SetMetaResult encapsulates the result of a SetMetaEx operation.

type SetOptions

type SetOptions struct {
	Key          []byte
	Value        []byte
	Flags        uint32
	Datatype     uint8
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

SetOptions encapsulates the parameters for a SetEx operation.

type SingleServerStats

type SingleServerStats struct {
	Stats map[string]string
	Error error
}

SingleServerStats represents the stats returned from a single server.

type SnapshotState

type SnapshotState uint32

SnapshotState represents the state of a particular cluster snapshot.

func (SnapshotState) HasInMemory

func (s SnapshotState) HasInMemory() bool

HasInMemory returns whether this snapshot is available in memory.

func (SnapshotState) HasOnDisk

func (s SnapshotState) HasOnDisk() bool

HasOnDisk returns whether this snapshot is available on disk.

type StatsExCallback

type StatsExCallback func(*StatsResult, error)

StatsExCallback is invoked upon completion of a StatsEx operation.

type StatsOptions

type StatsOptions struct {
	Key string
	// Target indicates that something specific should be targeted by the operation. If left nil
	// then the stats command will be sent to all servers.
	Target       StatsTarget
	TraceContext opentracing.SpanContext
}

StatsOptions encapsulates the parameters for a StatsEx operation.

type StatsResult

type StatsResult struct {
	Servers map[string]SingleServerStats
}

StatsResult encapsulates the result of a StatsEx operation.

type StatsTarget

type StatsTarget interface {
}

StatsTarget is used for providing a specific target to the StatsEx operation.

type StatusCode

type StatusCode uint16

StatusCode represents a memcached response status.

type StoreCallback

type StoreCallback func(Cas, MutationToken, error)

StoreCallback is invoked with the results of any basic storage operations. DEPRECATED

type StoreExCallback

type StoreExCallback func(*StoreResult, error)

StoreExCallback is invoked upon completion of a AddEx, SetEx or ReplaceEx operation.

type StoreInCallback

type StoreInCallback func(Cas, MutationToken, error)

StoreInCallback is invoked with the results of any sub-document storage operations. DEPRECATED

type StoreInExCallback

type StoreInExCallback func(*StoreInResult, error)

StoreInExCallback is invoked upon completion of a SetInEx, AddInEx, ReplaceInEx, PushFrontInEx, PushBackInEx, ArrayInsertInEx or AddUniqueInEx operation.

type StoreInOptions

type StoreInOptions struct {
	Key          []byte
	Path         string
	Value        []byte
	Flags        SubdocFlag
	Cas          Cas
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

StoreInOptions encapsulates the parameters for a SetInEx, AddInEx, ReplaceInEx, PushFrontInEx, PushBackInEx, ArrayInsertInEx or AddUniqueInEx operation.

type StoreInResult

type StoreInResult struct {
	Cas           Cas
	MutationToken MutationToken
}

StoreInResult encapsulates the result of a SetInEx, AddInEx, ReplaceInEx, PushFrontInEx, PushBackInEx, ArrayInsertInEx or AddUniqueInEx operation.

type StoreResult

type StoreResult struct {
	Cas           Cas
	MutationToken MutationToken
}

StoreResult encapsulates the result of a AddEx, SetEx or ReplaceEx operation.

type StreamObserver

type StreamObserver interface {
	SnapshotMarker(startSeqNo, endSeqNo uint64, vbId uint16, snapshotType SnapshotState)
	Mutation(seqNo, revNo uint64, flags, expiry, lockTime uint32, cas uint64, datatype uint8, vbId uint16, key, value []byte)
	Deletion(seqNo, revNo, cas uint64, datatype uint8, vbId uint16, key, value []byte)
	Expiration(seqNo, revNo, cas uint64, vbId uint16, key []byte)
	End(vbId uint16, err error)
}

StreamObserver provides an interface to receive events from a running DCP stream.

type SubDocMutateError

type SubDocMutateError struct {
	Err     error
	OpIndex int
}

SubDocMutateError encapsulates errors that occur during sub-document mutations.

func (SubDocMutateError) Error

func (e SubDocMutateError) Error() string

type SubDocOp

type SubDocOp struct {
	Op    SubDocOpType
	Flags SubdocFlag
	Path  string
	Value []byte
}

SubDocOp defines a per-operation structure to be passed to MutateIn or LookupIn for performing many sub-document operations.

type SubDocOpType

type SubDocOpType uint8

SubDocOpType specifies the type of a sub-document operation.

type SubDocResult

type SubDocResult struct {
	Err   error
	Value []byte
}

SubDocResult encapsulates the results from a single sub-document operation.

type SubdocDocFlag

type SubdocDocFlag uint8

SubdocDocFlag specifies document-level flags for a sub-document operation.

type SubdocFlag

type SubdocFlag uint8

SubdocFlag specifies flags for a sub-document operation.

type TouchCallback

type TouchCallback func(Cas, MutationToken, error)

TouchCallback is invoked with the results of `Touch` operations. DEPRECATED

type TouchExCallback

type TouchExCallback func(*TouchResult, error)

TouchExCallback is invoked upon completion of a TouchEx operation.

type TouchOptions

type TouchOptions struct {
	Key          []byte
	Cas          Cas
	Expiry       uint32
	TraceContext opentracing.SpanContext
}

TouchOptions encapsulates the parameters for a TouchEx operation.

type TouchResult

type TouchResult struct {
	Cas           Cas
	MutationToken MutationToken
}

TouchResult encapsulates the result of a TouchEx operation.

type UnlockCallback

type UnlockCallback func(Cas, MutationToken, error)

UnlockCallback is invoked with the results of `Unlock` operations. DEPRECATED

type UnlockExCallback

type UnlockExCallback func(*UnlockResult, error)

UnlockExCallback is invoked upon completion of a UnlockEx operation.

type UnlockOptions

type UnlockOptions struct {
	Key          []byte
	Cas          Cas
	TraceContext opentracing.SpanContext
}

UnlockOptions encapsulates the parameters for a UnlockEx operation.

type UnlockResult

type UnlockResult struct {
	Cas           Cas
	MutationToken MutationToken
}

UnlockResult encapsulates the result of a UnlockEx operation.

type UserPassPair

type UserPassPair struct {
	Username string
	Password string
}

UserPassPair represents a username and password pair.

type VBucketIdStatsTarget

type VBucketIdStatsTarget struct {
	Vbid uint16
}

VBucketIdStatsTarget indicates that a specific vbucket should be targeted by the StatsEx operation.

type VbSeqNoEntry

type VbSeqNoEntry struct {
	VbId  uint16
	SeqNo SeqNo
}

VbSeqNoEntry represents a single GetVbucketSeqnos sequence number entry.

type VbUuid

type VbUuid uint64

VbUuid represents a unique identifier for a particular vbucket history.

type VbucketState

type VbucketState uint32

VbucketState represents the state of a particular vbucket on a particular server.

Jump to

Keyboard shortcuts

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