gocbcore

package module
v8.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 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 previous major revision of its API. These branches are introduced just prior to any API breaking changes. Active work is performed on the master branch, with releases being performed as tags. Work made on master which are not yet part of a tagged released should be considered liable to change.

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 (
	// PlainAuthMechanism represents that PLAIN auth should be performed.
	PlainAuthMechanism = AuthMechanism("PLAIN")

	// ScramSha1AuthMechanism represents that SCRAM SHA1 auth should be performed.
	ScramSha1AuthMechanism = AuthMechanism("SCRAM_SHA1")

	// ScramSha256AuthMechanism represents that SCRAM SHA256 auth should be performed.
	ScramSha256AuthMechanism = AuthMechanism("SCRAM_SHA256")

	// ScramSha512AuthMechanism represents that SCRAM SHA512 auth should be performed.
	ScramSha512AuthMechanism = AuthMechanism("SCRAM_SHA512")
)
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(0x12)

	// 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)

	// FeatureAltRequests indicates support for requests with flexible frame extras.
	FeatureAltRequests = HelloFeature(0x10)

	// FeatureEnhancedDurability indicates support for requests synchronous durability requirements.
	FeatureEnhancedDurability = HelloFeature(0x11)
)
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)

	// StatusCollectionUnknown occurs when a Collection cannot be found.
	StatusCollectionUnknown = StatusCode(0x88)

	// StatusScopeUnknown occurs when a Scope cannot be found.
	StatusScopeUnknown = StatusCode(0x8c)

	// StatusDurabilityInvalidLevel occurs when an invalid durability level was requested.
	StatusDurabilityInvalidLevel = StatusCode(0xa0)

	// StatusDurabilityImpossible occurs when a request is performed with impossible
	// durability level requirements.
	StatusDurabilityImpossible = StatusCode(0xa1)

	// StatusSyncWriteInProgress occurs when an attempt is made to write to a key that has
	// a SyncWrite pending.
	StatusSyncWriteInProgress = StatusCode(0xa2)

	// StatusSyncWriteAmbiguous occurs when an SyncWrite does not complete in the specified
	// time and the result is ambiguous.
	StatusSyncWriteAmbiguous = StatusCode(0xa3)

	// StatusSyncWriteReCommitInProgress occurs when an SyncWrite is being recommitted.
	StatusSyncWriteReCommitInProgress = StatusCode(0xa4)

	// 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 (
	// StreamEventCollectionCreate is the StreamEventCode for a collection create event
	StreamEventCollectionCreate = StreamEventCode(0x00)

	// StreamEventCollectionDelete is the StreamEventCode for a collection delete event
	StreamEventCollectionDelete = StreamEventCode(0x01)

	// StreamEventCollectionFlush is the StreamEventCode for a collection flush event
	StreamEventCollectionFlush = StreamEventCode(0x02)

	// StreamEventScopeCreate is the StreamEventCode for a scope create event
	StreamEventScopeCreate = StreamEventCode(0x03)

	// StreamEventScopeDelete is the StreamEventCode for a scope delete event
	StreamEventScopeDelete = StreamEventCode(0x04)

	// StreamEventCollectionChanged is the StreamEventCode for a collection changed event
	StreamEventCollectionChanged = StreamEventCode(0x05)
)
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)

	// SubdocDocFlagAddDoc indices that this operation should be an add rather than set.
	SubdocDocFlagAddDoc = 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)
)
View Source
const (
	// Majority specifies that a change must be replicated to (held in memory)
	// a majority of the nodes for the bucket.
	Majority = DurabilityLevel(0x01)

	// MajorityAndPersistOnMaster specifies that a change must be replicated to (held in memory)
	// a majority of the nodes for the bucket and additionally persisted to disk on the active node.
	MajorityAndPersistOnMaster = DurabilityLevel(0x02)

	// PersistToMajority specifies that a change must be persisted to (written to disk)
	// a majority for the bucket.
	PersistToMajority = DurabilityLevel(0x03)
)
View Source
const (
	// ClusterCapabilityEnhancedPreparedStatements represents that the cluster supports enhanced prepared statements.
	ClusterCapabilityEnhancedPreparedStatements = ClusterCapability(0x01)
)

Variables

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

	// 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")

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

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

	// 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")

	// ErrInvalidService occurs when an explicit but invalid service type is specified
	ErrInvalidService = errors.New("invalid service")

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

	// ErrCollectionsUnsupported occurs when collections are used but either server does not support them or the agent
	// was created without them enabled.
	ErrCollectionsUnsupported = errors.New("collections are not enabled")

	// ErrBucketAlreadySelected occurs when SelectBucket is called when a bucket is already selected..
	ErrBucketAlreadySelected = errors.New("bucket already selected")

	// ErrShutdown occurs when operations are performed on a previously closed Agent.
	ErrShutdown = errors.New("connection shut down")

	// ErrOverload occurs when too many operations are dispatched and all queues are full.
	ErrOverload = errors.New("queue overflowed")

	// ErrSocketClosed occurs when a socket closes while an operation is in flight.
	ErrSocketClosed = io.EOF
)
View Source
var (
	// ErrTimeout occurs when an operation does not receive a response in a timely manner.
	ErrTimeout = errors.New("operation has timed out")

	ErrRequestCanceled       = errors.New("request canceled")
	ErrInvalidArgument       = errors.New("invalid argument")
	ErrServiceNotAvailable   = errors.New("service not available")
	ErrInternalServerFailure = errors.New("internal server failure")
	ErrAuthenticationFailure = errors.New("authentication failure")
	ErrTemporaryFailure      = errors.New("temporary failure")
	ErrParsingFailure        = errors.New("parsing failure")

	ErrCasMismatch          = errors.New("cas mismatch")
	ErrBucketNotFound       = errors.New("bucket not found")
	ErrCollectionNotFound   = errors.New("collection not found")
	ErrEncodingFailure      = errors.New("encoding failure")
	ErrDecodingFailure      = errors.New("decoding failure")
	ErrUnsupportedOperation = errors.New("unsupported operation")
	ErrAmbiguousTimeout     = &dwError{ErrTimeout, "ambiguous timeout"}

	ErrUnambiguousTimeout = &dwError{ErrTimeout, "unambiguous timeout"}

	// ErrFeatureNotAvailable occurs when an operation is performed on a bucket which does not support it.
	ErrFeatureNotAvailable = errors.New("feature is not available")
	ErrScopeNotFound       = errors.New("scope not found")
	ErrIndexNotFound       = errors.New("index not found")

	ErrIndexExists = errors.New("index exists")
)

Shared Error Definitions RFC#58@15

View Source
var (
	ErrDocumentNotFound                  = errors.New("document not found")
	ErrDocumentUnretrievable             = errors.New("document unretrievable")
	ErrDocumentLocked                    = errors.New("document locked")
	ErrValueTooLarge                     = errors.New("value too large")
	ErrDocumentExists                    = errors.New("document exists")
	ErrValueNotJSON                      = errors.New("value not json")
	ErrDurabilityLevelNotAvailable       = errors.New("durability level not available")
	ErrDurabilityImpossible              = errors.New("durability impossible")
	ErrDurabilityAmbiguous               = errors.New("durability ambiguous")
	ErrDurableWriteInProgress            = errors.New("durable write in progress")
	ErrDurableWriteReCommitInProgress    = errors.New("durable write recommit in progress")
	ErrMutationLost                      = errors.New("mutation lost")
	ErrPathNotFound                      = errors.New("path not found")
	ErrPathMismatch                      = errors.New("path mismatch")
	ErrPathInvalid                       = errors.New("path invalid")
	ErrPathTooBig                        = errors.New("path too big")
	ErrPathTooDeep                       = errors.New("path too deep")
	ErrValueTooDeep                      = errors.New("value too deep")
	ErrValueInvalid                      = errors.New("value invalid")
	ErrDocumentNotJSON                   = errors.New("document not json")
	ErrNumberTooBig                      = errors.New("number too big")
	ErrDeltaInvalid                      = errors.New("delta invalid")
	ErrPathExists                        = errors.New("path exists")
	ErrXattrUnknownMacro                 = errors.New("xattr unknown macro")
	ErrXattrInvalidFlagCombo             = errors.New("xattr invalid flag combination")
	ErrXattrInvalidKeyCombo              = errors.New("xattr invalid key combination")
	ErrXattrUnknownVirtualAttribute      = errors.New("xattr unknown virtual attribute")
	ErrXattrCannotModifyVirtualAttribute = errors.New("xattr cannot modify virtual attribute")
	ErrXattrInvalidOrder                 = errors.New("xattr invalid order")
)

Key Value Error Definitions RFC#58@15

View Source
var (
	ErrPlanningFailure = errors.New("planning failure")

	ErrIndexFailure = errors.New("index failure")

	ErrPreparedStatementFailure = errors.New("prepared statement failure")
)

Query Error Definitions RFC#58@15

View Source
var (
	ErrCompilationFailure = errors.New("compilation failure")

	ErrJobQueueFull = errors.New("job queue full")

	ErrDatasetNotFound = errors.New("dataset not found")

	ErrDataverseNotFound = errors.New("dataverse not found")

	ErrDatasetExists = errors.New("dataset exists")

	ErrDataverseExists = errors.New("dataverse exists")

	ErrLinkNotFound = errors.New("link not found")
)

Analytics Error Definitions RFC#58@15

View Source
var (
	ErrViewNotFound = errors.New("view not found")

	ErrDesignDocumentNotFound = errors.New("design document not found")
)

View Error Definitions RFC#58@15

View Source
var (
	ErrCollectionExists   = errors.New("collection exists")
	ErrScopeExists        = errors.New("scope exists")
	ErrUserNotFound       = errors.New("user not found")
	ErrGroupNotFound      = errors.New("group not found")
	ErrBucketExists       = errors.New("bucket exists")
	ErrUserExists         = errors.New("user exists")
	ErrBucketNotFlushable = errors.New("bucket not flushable")
)

Management Error Definitions RFC#58@15

View Source
var (
	// ErrDCPStreamClosed occurs when a DCP stream is closed gracefully.
	ErrDCPStreamClosed = makeStreamEndStatusError(streamEndClosed)

	// ErrDCPStreamStateChanged occurs when a DCP stream is interrupted by failover.
	ErrDCPStreamStateChanged = makeStreamEndStatusError(streamEndStateChanged)

	// ErrDCPStreamDisconnected occurs when a DCP stream is disconnected.
	ErrDCPStreamDisconnected = makeStreamEndStatusError(streamEndDisconnected)

	// ErrDCPStreamTooSlow 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.
	ErrDCPStreamTooSlow = makeStreamEndStatusError(streamEndTooSlow)

	// ErrDCPBackfillFailed occurs when there was an issue starting the backfill on
	// the server e.g. the requested start seqno was behind the purge seqno.
	ErrDCPBackfillFailed = makeStreamEndStatusError(streamEndBackfillFailed)

	// ErrDCPStreamFilterEmpty occurs when all of the collections for a DCP stream are
	// dropped.
	ErrDCPStreamFilterEmpty = makeStreamEndStatusError(streamEndFilterEmpty)
)
View Source
var (
	// ErrMemdKeyNotFound occurs when an operation is performed on a key that does not exist.
	ErrMemdKeyNotFound = makeKvStatusError(StatusKeyNotFound)

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

	// ErrMemdTooBig 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).
	ErrMemdTooBig = makeKvStatusError(StatusTooBig)

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

	// ErrMemdNotStored occurs when the server fails to store a key.
	ErrMemdNotStored = makeKvStatusError(StatusNotStored)

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

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

	// ErrMemdNoBucket occurs when no bucket was selected on a connection.
	ErrMemdNoBucket = makeKvStatusError(StatusNoBucket)

	// ErrMemdLocked occurs when a document is already locked.
	ErrMemdLocked = makeKvStatusError(StatusLocked)

	// ErrMemdAuthStale occurs when authentication credentials have become invalidated.
	ErrMemdAuthStale = makeKvStatusError(StatusAuthStale)

	// ErrMemdAuthError occurs when the authentication information provided was not valid.
	ErrMemdAuthError = makeKvStatusError(StatusAuthError)

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

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

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

	// ErrMemdAccessError occurs when an access error occurs.
	ErrMemdAccessError = makeKvStatusError(StatusAccessError)

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

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

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

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

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

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

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

	// ErrMemdCollectionNotFound occurs when a Collection cannot be found.
	ErrMemdCollectionNotFound = makeKvStatusError(StatusCollectionUnknown)

	// ErrMemdScopeNotFound occurs when a Collection cannot be found.
	ErrMemdScopeNotFound = makeKvStatusError(StatusScopeUnknown)

	// ErrMemdDurabilityInvalidLevel occurs when an invalid durability level was requested.
	ErrMemdDurabilityInvalidLevel = makeKvStatusError(StatusDurabilityInvalidLevel)

	// ErrMemdDurabilityImpossible occurs when a request is performed with impossible
	//  durability level requirements.
	ErrMemdDurabilityImpossible = makeKvStatusError(StatusDurabilityImpossible)

	// ErrMemdSyncWriteInProgess occurs when an attempt is made to write to a key that has
	//  a SyncWrite pending.
	ErrMemdSyncWriteInProgess = makeKvStatusError(StatusSyncWriteInProgress)

	// ErrMemdSyncWriteAmbiguous occurs when an SyncWrite does not complete in the specified
	// time and the result is ambiguous.
	ErrMemdSyncWriteAmbiguous = makeKvStatusError(StatusSyncWriteAmbiguous)

	// ErrMemdSyncWriteReCommitInProgress occurs when an SyncWrite is being recommitted.
	ErrMemdSyncWriteReCommitInProgress = makeKvStatusError(StatusSyncWriteReCommitInProgress)

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

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

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

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

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

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

	// ErrMemdSubDocNotJSON occurs when a sub-document operation is performed on a
	// document which is not JSON.
	ErrMemdSubDocNotJSON = makeKvStatusError(StatusSubDocNotJSON)

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

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

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

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

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

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

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

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

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

	// ErrMemdSubDocXattrUnknownMacro occurs when an invalid macro value is specified.
	ErrMemdSubDocXattrUnknownMacro = makeKvStatusError(StatusSubDocXattrUnknownMacro)

	// ErrMemdSubDocXattrUnknownVAttr occurs when an invalid virtual attribute is specified.
	ErrMemdSubDocXattrUnknownVAttr = makeKvStatusError(StatusSubDocXattrUnknownVAttr)

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

	// ErrMemdSubDocMultiPathFailureDeleted occurs when a Multi Path Failure occurs on
	// a soft-deleted document.
	ErrMemdSubDocMultiPathFailureDeleted = makeKvStatusError(StatusSubDocMultiPathFailureDeleted)
)
View Source
var (
	// UnknownRetryReason indicates that the operation failed for an unknown reason.
	UnknownRetryReason = retryReason{/* contains filtered or unexported fields */}

	// SocketNotAvailableRetryReason indicates that the operation failed because the underlying socket was not available.
	SocketNotAvailableRetryReason = retryReason{/* contains filtered or unexported fields */}

	// ServiceNotAvailableRetryReason indicates that the operation failed because the requested service was not available.
	ServiceNotAvailableRetryReason = retryReason{/* contains filtered or unexported fields */}

	// NodeNotAvailableRetryReason indicates that the operation failed because the requested node was not available.
	NodeNotAvailableRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVNotMyVBucketRetryReason indicates that the operation failed because it was sent to the wrong node for the vbucket.
	KVNotMyVBucketRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVCollectionOutdatedRetryReason indicates that the operation failed because the collection ID on the request is outdated.
	KVCollectionOutdatedRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVErrMapRetryReason indicates that the operation failed for an unsupported reason but the KV error map indicated
	// that the operation can be retried.
	KVErrMapRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVLockedRetryReason indicates that the operation failed because the document was locked.
	KVLockedRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVTemporaryFailureRetryReason indicates that the operation failed because of a temporary failure.
	KVTemporaryFailureRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVSyncWriteInProgressRetryReason indicates that the operation failed because a sync write is in progress.
	KVSyncWriteInProgressRetryReason = retryReason{/* contains filtered or unexported fields */}

	// KVSyncWriteRecommitInProgressRetryReason indicates that the operation failed because a sync write recommit is in progress.
	KVSyncWriteRecommitInProgressRetryReason = retryReason{/* contains filtered or unexported fields */}

	// ServiceResponseCodeIndicatedRetryReason indicates that the operation failed and the service responded stating that
	// the request should be retried.
	ServiceResponseCodeIndicatedRetryReason = retryReason{/* contains filtered or unexported fields */}

	// SocketCloseInFlightRetryReason indicates that the operation failed because the socket was closed whilst the operation
	// was in flight.
	SocketCloseInFlightRetryReason = retryReason{/* contains filtered or unexported fields */}

	// PipelineOverloadedRetryReason indicates that the operation failed because the pipeline queue was full.
	PipelineOverloadedRetryReason = retryReason{/* contains filtered or unexported fields */}

	// CircuitBreakerOpenRetryReason indicates that the operation failed because the circuit breaker for the underlying socket was open.
	CircuitBreakerOpenRetryReason = retryReason{/* contains filtered or unexported fields */}

	// QueryIndexNotFoundRetryReason indicates that the operation failed to to a missing query index
	QueryIndexNotFoundRetryReason = retryReason{/* contains filtered or unexported fields */}

	// QueryPreparedStatementFailureRetryReason indicates that the operation failed due to a prepared statement failure
	QueryPreparedStatementFailureRetryReason = retryReason{/* contains filtered or unexported fields */}

	// AnalyticsTemporaryFailureRetryReason indicates that an analytics operation failed due to a temporary failure
	AnalyticsTemporaryFailureRetryReason = retryReason{/* contains filtered or unexported fields */}

	// SearchTooManyRequestsRetryReason indicates that a search operation failed due to too many requests
	SearchTooManyRequestsRetryReason = retryReason{/* contains filtered or unexported fields */}
)

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 ControlledBackoff

func ControlledBackoff(retryAttempts uint32) time.Duration

ControlledBackoff calculates a backoff time duration from the retry attempts on a given request.

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 ReleaseTimer

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

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

func SaslAuthPlain

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

SaslAuthPlain performs PLAIN SASL authentication against an AuthClient.

func SaslAuthScramSha1

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

SaslAuthScramSha1 performs SCRAM-SHA1 SASL authentication against an AuthClient.

func SaslAuthScramSha256

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

SaslAuthScramSha256 performs SCRAM-SHA256 SASL authentication against an AuthClient.

func SaslAuthScramSha512

func SaslAuthScramSha512(username, password string, client AuthClient, deadline time.Time, continueCb func(), completedCb func(err error)) 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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	Value                  []byte
	Flags                  uint32
	Datatype               uint8
	Expiry                 uint32
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	Cas                    Cas
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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(config *AgentConfig) (*Agent, error)

CreateAgent creates an agent for performing normal operations.

func CreateDcpAgent

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

CreateDcpAgent creates an agent for performing DCP operations.

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) 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) 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) AnalyticsQuery

func (agent *Agent) AnalyticsQuery(opts AnalyticsQueryOptions) (*AnalyticsRowReader, error)

AnalyticsQuery executes an analytics query

func (*Agent) AppendEx

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

AppendEx appends some bytes to a document.

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) CloseStreamWithID

func (agent *Agent) CloseStreamWithID(vbID uint16, streamID uint16, cb CloseStreamCallback) (PendingOp, error)

CloseStreamWithID shuts down an open stream for the specified VBucket for the specified stream.

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) 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) 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) 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) GetAndLockEx

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

GetAndLockEx retrieves a document and locks it.

func (*Agent) GetAndTouchEx

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

GetAndTouchEx retrieves a document and updates its expiry.

func (*Agent) GetCollectionID

func (agent *Agent) GetCollectionID(scopeName string, collectionName string, opts GetCollectionIDOptions, cb CollectionIDCallback) (PendingOp, error)

GetCollectionID fetches the collection id and manifest id that the collection belongs to, given a scope name and collection name. This function will also prime the client's collection id cache.

func (*Agent) GetCollectionManifest

func (agent *Agent) GetCollectionManifest(opts GetCollectionManifestOptions, cb ManifestCallback) (PendingOp, error)

GetCollectionManifest fetches the current server manifest. This function will not update the client's collection id cache.

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) 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) GetMetaEx

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

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

func (*Agent) GetOneReplicaEx

func (agent *Agent) GetOneReplicaEx(opts GetOneReplicaOptions, cb GetReplicaExCallback) (PendingOp, error)

GetOneReplicaEx retrieves a document from a replica server.

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) 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) GetVbucketSeqnosWithCollectionID

func (agent *Agent) GetVbucketSeqnosWithCollectionID(serverIdx int, state VbucketState, collectionID uint32, cb GetVBucketSeqnosCallback) (PendingOp, error)

GetVbucketSeqnosWithCollectionID returns the last checkpoint for a particular VBucket for a particular collection. 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) HasCollectionsSupport

func (agent *Agent) HasCollectionsSupport() bool

HasCollectionsSupport verifies whether or not collections are available on the agent.

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) MaybeRetryRequest

func (agent *Agent) MaybeRetryRequest(req RetryRequest, reason RetryReason) (bool, time.Time)

MaybeRetryRequest will possibly retry a request according to the strategy belonging to the request. It will use the reason to determine whether or not the failure reason is one that can be retried.

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) N1QLQuery

func (agent *Agent) N1QLQuery(opts N1QLQueryOptions) (*N1QLRowReader, error)

N1QLQuery executes a N1QL query

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) ObserveEx

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

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

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, filter *StreamFilter, cb OpenStreamCallback) (PendingOp, error)

OpenStream opens a DCP stream for a particular VBucket and, optionally, filter.

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) PrependEx

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

PrependEx prepends some bytes to a document.

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) 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) ReplaceEx

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

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

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) SearchQuery

func (agent *Agent) SearchQuery(opts SearchQueryOptions) (*SearchRowReader, error)

SearchQuery executes a Search query

func (*Agent) SelectBucket

func (agent *Agent) SelectBucket(bucketName string, deadline time.Time) error

SelectBucket performs a select bucket operation against the cluster.

func (*Agent) ServerConnectTimeout

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

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

func (*Agent) SetEx

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

SetEx stores a document.

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) 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) 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) SupportsClusterCapability

func (agent *Agent) SupportsClusterCapability(capability ClusterCapability) bool

SupportsClusterCapability returns whether or not the cluster supports a given capability.

func (*Agent) TouchEx

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

TouchEx updates the expiry for a document.

func (*Agent) UnlockEx

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

UnlockEx unlocks a locked document.

func (*Agent) UsingGCCCP

func (agent *Agent) UsingGCCCP() bool

UsingGCCCP returns whether or not the Agent is currently using GCCCP polling.

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.

func (*Agent) ViewQuery

func (agent *Agent) ViewQuery(opts ViewQueryOptions) (*ViewQueryRowReader, error)

ViewQuery executes a view query

type AgentConfig

type AgentConfig struct {
	UserAgent   string
	MemdAddrs   []string
	HTTPAddrs   []string
	UseTLS      bool
	BucketName  string
	NetworkType string
	Auth        AuthProvider

	TLSRootCAs    *x509.CertPool
	TLSSkipVerify bool

	UseMutationTokens    bool
	UseCompression       bool
	UseDurations         bool
	DisableDecompression bool

	UseCollections bool

	CompressionMinSize  int
	CompressionMinRatio float64

	HTTPRedialPeriod time.Duration
	HTTPRetryDelay   time.Duration
	CccpMaxWait      time.Duration
	CccpPollPeriod   time.Duration

	ConnectTimeout   time.Duration
	KVConnectTimeout time.Duration

	KvPoolSize   int
	MaxQueueSize int

	HTTPMaxIdleConns          int
	HTTPMaxIdleConnsPerHost   int
	HTTPIdleConnectionTimeout time.Duration

	// Volatile: Tracer API is subject to change.
	Tracer           RequestTracer
	NoRootTraceSpans bool

	DefaultRetryStrategy RetryStrategy
	CircuitBreakerConfig CircuitBreakerConfig

	UseZombieLogger        bool
	ZombieLoggerInterval   time.Duration
	ZombieLoggerSampleSize int

	DcpAgentPriority DcpAgentPriority
	UseDCPExpiry     bool
	UseDCPStreamID   bool
}

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:

bootstrap_on (bool) - Specifies what protocol to bootstrap on (cccp, http).
ca_cert_path (string) - Specifies the path to a CA certificate.
network (string) - The network type to use.
kv_connect_timeout (duration) - Maximum period to attempt to connect to cluster in ms.
config_poll_interval (duration) - Period to wait between CCCP config polling in ms.
config_poll_timeout (duration) - Maximum period of time to wait for a CCCP request.
compression (bool) - Whether to enable network-wise compression of documents.
compression_min_size (int) - The minimal size of the document in bytes to consider compression.
compression_min_ratio (float64) - The minimal compress ratio (compressed / original) for the document to be sent compressed.
enable_server_durations (bool) - Whether to enable fetching server operation durations.
max_idle_http_connections (int) - Maximum number of idle http connections in the pool.
max_perhost_idle_http_connections (int) - Maximum number of idle http connections in the pool per host.
idle_http_connection_timeout (duration) - Maximum length of time for an idle connection to stay in the pool in ms.
orphaned_response_logging (bool) - Whether to enable orphaned response logging.
orphaned_response_logging_interval (duration) - How often to print the orphan log records.
orphaned_response_logging_sample_size (int) - The maximum number of orphan log records to track.
dcp_priority (int) - Specifies the priority to request from the Cluster when connecting for DCP.
enable_dcp_expiry (bool) - Whether to enable the feature to distinguish between explicit delete and expired delete on DCP.
http_redial_period (duration) - The maximum length of time for the HTTP poller to stay connected before reconnecting.
http_retry_delay (duration) - The length of time to wait between HTTP poller retries if connecting fails.
kv_pool_size (int) - The number of connections to create to each kv node.
max_queue_size (int) - The maximum number of requests that can be queued for sending per connection.

type AnalyticsError

type AnalyticsError struct {
	InnerError      error                `json:"-"`
	Statement       string               `json:"statement,omitempty"`
	ClientContextID string               `json:"client_context_id,omitempty"`
	Errors          []AnalyticsErrorDesc `json:"errors,omitempty"`
	Endpoint        string               `json:"endpoint,omitempty"`
	RetryReasons    []RetryReason        `json:"retry_reasons,omitempty"`
	RetryAttempts   uint32               `json:"retry_attempts,omitempty"`
}

AnalyticsError represents an error returned from an analytics query.

func (AnalyticsError) Error

func (e AnalyticsError) Error() string

Error returns the string representation of this error.

func (AnalyticsError) Unwrap

func (e AnalyticsError) Unwrap() error

Unwrap returns the underlying reason for the error

type AnalyticsErrorDesc

type AnalyticsErrorDesc struct {
	Code    uint32
	Message string
}

AnalyticsErrorDesc represents specific analytics error data.

type AnalyticsQueryOptions

type AnalyticsQueryOptions struct {
	Payload       []byte
	Priority      int
	RetryStrategy RetryStrategy
	Deadline      time.Time

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

AnalyticsQueryOptions represents the various options available for an analytics query.

type AnalyticsRowReader

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

AnalyticsRowReader providers access to the rows of a analytics query

func (*AnalyticsRowReader) Close

func (q *AnalyticsRowReader) Close() error

Close immediately shuts down the connection

func (AnalyticsRowReader) Err

func (q AnalyticsRowReader) Err() error

Err returns any errors that occurred during streaming.

func (*AnalyticsRowReader) MetaData

func (q *AnalyticsRowReader) MetaData() ([]byte, error)

MetaData fetches the non-row bytes streamed in the response.

func (*AnalyticsRowReader) NextRow

func (q *AnalyticsRowReader) NextRow() []byte

NextRow reads the next rows bytes from the stream

type AuthCertRequest

type AuthCertRequest struct {
	Service  ServiceType
	Endpoint string
}

AuthCertRequest represents a certificate details request from the agent.

type AuthClient

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

	SaslListMechs(deadline time.Time, cb func(mechs []AuthMechanism, err error)) error
	SaslAuth(k, v []byte, deadline time.Time, cb func(b []byte, err error)) error
	SaslStep(k, v []byte, deadline time.Time, cb func(err error)) 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, continueCb func(), completedCb func(error)) error

AuthFunc is invoked by the agent to authenticate a client. This function returns two channels to allow for for multi-stage authentication processes (such as SCRAM). The continue callback should be called when further asynchronous bootstrapping requests (such as select bucket) can be sent. The completed callback should be called when authentication is completed, or failed. It should contain any error that occurred. If completed is called before continue then continue will be called first internally, the success value will be determined by whether or not an error is present.

type AuthMechanism

type AuthMechanism string

AuthMechanism represents a type of auth that can be performed.

type AuthProvider

type AuthProvider interface {
	SupportsTLS() bool
	SupportsNonTLS() bool
	Certificate(req AuthCertRequest) (*tls.Certificate, error)
	Credentials(req AuthCredsRequest) ([]UserPassPair, error)
}

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

type BackoffCalculator added in v8.0.4

type BackoffCalculator func(retryAttempts uint32) time.Duration

BackoffCalculator is used by retry strategies to calculate backoff durations.

func ExponentialBackoff added in v8.0.4

func ExponentialBackoff(min, max time.Duration, backoffFactor float64) BackoffCalculator

ExponentialBackoff calculates a backoff time duration from the retry attempts on a given request.

type BestEffortRetryStrategy

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

BestEffortRetryStrategy represents a strategy that will keep retrying until it succeeds (or the caller times out the request).

func NewBestEffortRetryStrategy

func NewBestEffortRetryStrategy(calculator BackoffCalculator) *BestEffortRetryStrategy

NewBestEffortRetryStrategy returns a new BestEffortRetryStrategy which will use the supplied calculator function to calculate retry durations. If calculator is nil then ControlledBackoff will be used.

func (*BestEffortRetryStrategy) RetryAfter

func (rs *BestEffortRetryStrategy) RetryAfter(req RetryRequest, reason RetryReason) RetryAction

RetryAfter calculates and returns a RetryAction describing how long to wait before retrying an operation.

type BytesAndError

type BytesAndError struct {
	Err   error
	Bytes []byte
}

BytesAndError contains the raw bytes of the result of an operation, and/or the error that occurred.

type Cas

type Cas uint64

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

type CircuitBreakerCallback

type CircuitBreakerCallback func(error) bool

CircuitBreakerCallback is the callback used by the circuit breaker to determine if an error should count toward the circuit breaker failure count.

type CircuitBreakerConfig

type CircuitBreakerConfig struct {
	Enabled                  bool
	VolumeThreshold          int64
	ErrorThresholdPercentage float64
	SleepWindow              time.Duration
	RollingWindow            time.Duration
	CompletionCallback       CircuitBreakerCallback
	CanaryTimeout            time.Duration
}

CircuitBreakerConfig is the set of configuration settings for configuring circuit breakers. If Disabled is set to true then a noop circuit breaker will be used, otherwise a lazy circuit breaker.

type CloseStreamCallback

type CloseStreamCallback func(error)

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

type ClusterCapability

type ClusterCapability uint32

ClusterCapability represents a capability that the cluster supports

type CollectionIDCallback

type CollectionIDCallback func(manifestID uint64, collectionID uint32, err error)

CollectionIDCallback is invoked upon completion of a GetCollectionID operation.

type CompressionType

type CompressionType uint32

CompressionType indicates the type of compression for a value

type CounterExCallback

type CounterExCallback func(*CounterResult, error)

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

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	Cas                    Cas
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	Cas                    Cas
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 DurabilityLevel

type DurabilityLevel uint8

DurabilityLevel specifies the level to use for enhanced durability requirements.

type ExecHelloResponse

type ExecHelloResponse struct {
	SrvFeatures []HelloFeature
	Err         error
}

ExecHelloResponse contains the features and/or error from an ExecHello operation.

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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 GetAnyReplicaOptions

type GetAnyReplicaOptions struct {
	Key            []byte
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

GetAnyReplicaOptions encapsulates the parameters for a GetAnyReplicaEx operation.

type GetCollectionIDOptions

type GetCollectionIDOptions struct {
	RetryStrategy RetryStrategy
	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

GetCollectionIDOptions are the options available to the GetCollectionID command.

type GetCollectionManifestOptions

type GetCollectionManifestOptions struct {
	// Volatile: Tracer API is subject to change.
	TraceContext  RequestSpanContext
	RetryStrategy RetryStrategy
}

GetCollectionManifestOptions are the options available to the GetCollectionManifest command.

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 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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 GetMetaExCallback

type GetMetaExCallback func(*GetMetaResult, error)

GetMetaExCallback is invoked upon completion of a GetMetaEx operation.

type GetMetaOptions

type GetMetaOptions struct {
	Key            []byte
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 GetOneReplicaOptions

type GetOneReplicaOptions struct {
	Key            []byte
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy
	ReplicaIdx     int

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

GetOneReplicaOptions encapsulates the parameters for a GetOneReplicaEx operation.

type GetOptions

type GetOptions struct {
	Key            []byte
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

GetOptions encapsulates the parameters for a GetEx operation.

type GetRandomExCallback

type GetRandomExCallback func(*GetRandomResult, error)

GetRandomExCallback is invoked upon completion of a GetRandomEx operation.

type GetRandomOptions

type GetRandomOptions struct {
	RetryStrategy RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 GetReplica operation.

type GetReplicaResult

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

GetReplicaResult encapsulates the result of a GetReplica 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 HTTPError

type HTTPError struct {
	InnerError    error         `json:"-"`
	UniqueID      string        `json:"unique_id,omitempty"`
	Endpoint      string        `json:"endpoint,omitempty"`
	RetryReasons  []RetryReason `json:"retry_reasons,omitempty"`
	RetryAttempts uint32        `json:"retry_attempts,omitempty"`
}

HTTPError represents an error returned from an HTTP request.

func (HTTPError) Error

func (e HTTPError) Error() string

Error returns the string representation of this error.

func (HTTPError) Unwrap

func (e HTTPError) Unwrap() error

Unwrap returns the underlying reason for the error

type HTTPRequest

type HTTPRequest struct {
	Service       ServiceType
	Method        string
	Endpoint      string
	Path          string
	Username      string
	Password      string
	Body          []byte
	Headers       map[string]string
	ContentType   string
	IsIdempotent  bool
	UniqueID      string
	Timeout       time.Duration
	RetryStrategy RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 HelloFeature

type HelloFeature uint16

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

type KeyState

type KeyState uint8

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

type KeyValueError

type KeyValueError struct {
	InnerError         error         `json:"-"`
	StatusCode         StatusCode    `json:"status_code,omitempty"`
	BucketName         string        `json:"bucket,omitempty"`
	ScopeName          string        `json:"scope,omitempty"`
	CollectionName     string        `json:"collection,omitempty"`
	CollectionID       uint32        `json:"collection_id,omitempty"`
	ErrorName          string        `json:"error_name,omitempty"`
	ErrorDescription   string        `json:"error_description,omitempty"`
	Opaque             uint32        `json:"opaque,omitempty"`
	Context            string        `json:"context,omitempty"`
	Ref                string        `json:"ref,omitempty"`
	RetryReasons       []RetryReason `json:"retry_reasons,omitempty"`
	RetryAttempts      uint32        `json:"retry_attempts,omitempty"`
	LastDispatchedTo   string        `json:"last_dispatched_to,omitempty"`
	LastDispatchedFrom string        `json:"last_dispatched_from,omitempty"`
	LastConnectionID   string        `json:"last_connection_id,omitempty"`
}

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

func (KeyValueError) Error

func (e KeyValueError) Error() string

Error returns the string representation of this error.

func (KeyValueError) Unwrap

func (e KeyValueError) Unwrap() error

Unwrap returns the underlying reason for the error

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 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 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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 Manifest

type Manifest struct {
	UID    uint64
	Scopes []ManifestScope
}

Manifest is the representation of a collections manifest.

func (*Manifest) UnmarshalJSON

func (item *Manifest) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom implementation of json unmarshaling.

type ManifestCallback

type ManifestCallback func(manifest []byte, err error)

ManifestCallback is invoked upon completion of a GetCollectionManifest operation.

type ManifestCollection

type ManifestCollection struct {
	UID  uint32
	Name string
}

ManifestCollection is the representation of a collection within a manifest.

func (*ManifestCollection) UnmarshalJSON

func (item *ManifestCollection) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom implementation of json unmarshaling.

type ManifestScope

type ManifestScope struct {
	UID         uint32
	Name        string
	Collections []ManifestCollection
}

ManifestScope is the representation of a scope within a manifest.

func (*ManifestScope) UnmarshalJSON

func (item *ManifestScope) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom implementation of json unmarshaling.

type MemdConnInfo

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

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

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 N1QLError

type N1QLError struct {
	InnerError      error           `json:"-"`
	Statement       string          `json:"statement,omitempty"`
	ClientContextID string          `json:"client_context_id,omitempty"`
	Errors          []N1QLErrorDesc `json:"errors,omitempty"`
	Endpoint        string          `json:"endpoint,omitempty"`
	RetryReasons    []RetryReason   `json:"retry_reasons,omitempty"`
	RetryAttempts   uint32          `json:"retry_attempts,omitempty"`
}

N1QLError represents an error returned from a n1ql query.

func (N1QLError) Error

func (e N1QLError) Error() string

Error returns the string representation of this error.

func (N1QLError) Unwrap

func (e N1QLError) Unwrap() error

Unwrap returns the underlying reason for the error

type N1QLErrorDesc

type N1QLErrorDesc struct {
	Code    uint32
	Message string
}

N1QLErrorDesc represents specific n1ql error data.

type N1QLQueryOptions

type N1QLQueryOptions struct {
	Payload       []byte
	RetryStrategy RetryStrategy
	Deadline      time.Time

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

N1QLQueryOptions represents the various options available for a n1ql query.

type N1QLRowReader

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

N1QLRowReader providers access to the rows of a n1ql query

func (*N1QLRowReader) Close

func (q *N1QLRowReader) Close() error

Close immediately shuts down the connection

func (N1QLRowReader) Err

func (q N1QLRowReader) Err() error

Err returns any errors that occurred during streaming.

func (*N1QLRowReader) MetaData

func (q *N1QLRowReader) MetaData() ([]byte, error)

MetaData fetches the non-row bytes streamed in the response.

func (*N1QLRowReader) NextRow

func (q *N1QLRowReader) NextRow() []byte

NextRow reads the next rows bytes from the stream

func (N1QLRowReader) PreparedName added in v8.0.2

func (q N1QLRowReader) PreparedName() (string, error)

PreparedName returns the name of the prepared statement created when using enhanced prepared statements. If the prepared name has not been seen on the stream then this will return an error. Volatile: This API is subject to change.

type NoRetryRetryAction

type NoRetryRetryAction struct {
}

NoRetryRetryAction represents an action that indicates to not retry.

func (*NoRetryRetryAction) Duration

func (ra *NoRetryRetryAction) Duration() time.Duration

Duration is the length of time to wait before retrying an operation.

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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 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
	RetryStrategy RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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) Certificate

func (auth *PasswordAuthProvider) Certificate(req AuthCertRequest) (*tls.Certificate, error)

Certificate directly returns a certificate chain to present for the connection.

func (*PasswordAuthProvider) Credentials

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

Credentials directly returns the username/password from the provider.

func (*PasswordAuthProvider) SupportsNonTLS

func (auth *PasswordAuthProvider) SupportsNonTLS() bool

SupportsNonTLS specifies whether this authenticator supports non-TLS connections.

func (*PasswordAuthProvider) SupportsTLS

func (auth *PasswordAuthProvider) SupportsTLS() bool

SupportsTLS specifies whether this authenticator supports TLS connections.

type PendingOp

type PendingOp interface {
	Cancel(err error)
}

PendingOp represents an outstanding operation within the client. This can be used to cancel an operation before it completes. This can also be used to get information about the operation once it has completed (cancelled or successful).

type PingKvExCallback

type PingKvExCallback func(*PingKvResult, error)

PingKvExCallback is invoked upon completion of a PingKvEx operation.

type PingKvOptions

type PingKvOptions struct {
	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

PingKvOptions encapsulates the parameters for a PingKvEx operation.

type PingKvResult

type PingKvResult struct {
	ConfigRev int64
	Services  []PingResult
}

PingKvResult encapsulates the result of a PingKvEx operation.

type PingResult

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

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

type ReplaceOptions

type ReplaceOptions struct {
	Key                    []byte
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	Value                  []byte
	Flags                  uint32
	Datatype               uint8
	Cas                    Cas
	Expiry                 uint32
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

ReplaceOptions encapsulates the parameters for a ReplaceEx operation.

type RequestSpan

type RequestSpan interface {
	Finish()
	Context() RequestSpanContext
	SetTag(key string, value interface{}) RequestSpan
}

RequestSpan is the interface for spans that are created by a RequestTracer.

type RequestSpanContext

type RequestSpanContext interface {
}

RequestSpanContext is the interface for for external span contexts that can be passed in into the SDK option blocks.

type RequestTracer

type RequestTracer interface {
	StartSpan(operationName string, parentContext RequestSpanContext) RequestSpan
}

RequestTracer describes the tracing abstraction in the SDK.

type RetryAction

type RetryAction interface {
	Duration() time.Duration
}

RetryAction is used by a RetryStrategy to calculate the duration to wait before retrying an operation. Returning a value of 0 indicates to not retry.

type RetryReason

type RetryReason interface {
	AllowsNonIdempotentRetry() bool
	AlwaysRetry() bool
	Description() string
}

RetryReason represents the reason for an operation possibly being retried.

type RetryRequest

type RetryRequest interface {
	RetryAttempts() uint32
	Identifier() string
	Idempotent() bool
	RetryReasons() []RetryReason
	// contains filtered or unexported methods
}

RetryRequest is a request that can possibly be retried.

type RetryStrategy

type RetryStrategy interface {
	RetryAfter(req RetryRequest, reason RetryReason) RetryAction
}

RetryStrategy is to determine if an operation should be retried, and if so how long to wait before retrying.

type SaslListMechsCompleted

type SaslListMechsCompleted struct {
	Err   error
	Mechs []AuthMechanism
}

SaslListMechsCompleted is used to contain the result and/or error from a SaslListMechs operation.

type SearchError

type SearchError struct {
	InnerError       error         `json:"-"`
	IndexName        string        `json:"index_name,omitempty"`
	Query            interface{}   `json:"query,omitempty"`
	ErrorText        string        `json:"error_text"`
	HTTPResponseCode int           `json:"status_code,omitempty"`
	Endpoint         string        `json:"endpoint,omitempty"`
	RetryReasons     []RetryReason `json:"retry_reasons,omitempty"`
	RetryAttempts    uint32        `json:"retry_attempts,omitempty"`
}

SearchError represents an error returned from a search query.

func (SearchError) Error

func (e SearchError) Error() string

Error returns the string representation of this error.

func (SearchError) Unwrap

func (e SearchError) Unwrap() error

Unwrap returns the underlying reason for the error

type SearchQueryOptions

type SearchQueryOptions struct {
	IndexName     string
	Payload       []byte
	RetryStrategy RetryStrategy
	Deadline      time.Time

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

SearchQueryOptions represents the various options available for a search query.

type SearchRowReader

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

SearchRowReader providers access to the rows of a view query

func (*SearchRowReader) Close

func (q *SearchRowReader) Close() error

Close immediately shuts down the connection

func (SearchRowReader) Err

func (q SearchRowReader) Err() error

Err returns any errors that occurred during streaming.

func (*SearchRowReader) MetaData

func (q *SearchRowReader) MetaData() ([]byte, error)

MetaData fetches the non-row bytes streamed in the response.

func (*SearchRowReader) NextRow

func (q *SearchRowReader) NextRow() []byte

NextRow reads the next rows bytes from the stream

type SeqNo

type SeqNo uint64

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

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
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	Value                  []byte
	Flags                  uint32
	Datatype               uint8
	Expiry                 uint32
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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
	RetryStrategy RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 StoreExCallback

type StoreExCallback func(*StoreResult, error)

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

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
	CollectionName         string
	ScopeName              string
	RetryStrategy          RetryStrategy
	DurabilityLevel        DurabilityLevel
	DurabilityLevelTimeout uint16
	CollectionID           uint32

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 StreamEndStatus

type StreamEndStatus uint32

StreamEndStatus represents the reason for a DCP stream ending

type StreamEventCode

type StreamEventCode uint32

StreamEventCode is the code for a DCP Stream event

type StreamFilter

type StreamFilter struct {
	ManifestUID uint64
	Collections []uint32
	Scope       uint32
	StreamID    uint16
}

StreamFilter provides options for filtering a DCP stream.

func NewStreamFilter

func NewStreamFilter() *StreamFilter

NewStreamFilter returns a new StreamFilter.

type StreamObserver

type StreamObserver interface {
	SnapshotMarker(startSeqNo, endSeqNo uint64, vbID uint16, streamID uint16, snapshotType SnapshotState)
	Mutation(seqNo, revNo uint64, flags, expiry, lockTime uint32, cas uint64, datatype uint8, vbID uint16, collectionID uint32, streamID uint16, key, value []byte)
	Deletion(seqNo, revNo, cas uint64, datatype uint8, vbID uint16, collectionID uint32, streamID uint16, key, value []byte)
	Expiration(seqNo, revNo, cas uint64, vbID uint16, collectionID uint32, streamID uint16, key []byte)
	End(vbID uint16, streamID uint16, err error)
	CreateCollection(seqNo uint64, version uint8, vbID uint16, manifestUID uint64, scopeID uint32, collectionID uint32, ttl uint32, streamID uint16, key []byte)
	DeleteCollection(seqNo uint64, version uint8, vbID uint16, manifestUID uint64, scopeID uint32, collectionID uint32, streamID uint16)
	FlushCollection(seqNo uint64, version uint8, vbID uint16, manifestUID uint64, collectionID uint32)
	CreateScope(seqNo uint64, version uint8, vbID uint16, manifestUID uint64, scopeID uint32, streamID uint16, key []byte)
	DeleteScope(seqNo uint64, version uint8, vbID uint16, manifestUID uint64, scopeID uint32, streamID uint16)
	ModifyCollection(seqNo uint64, version uint8, vbID uint16, manifestUID uint64, collectionID uint32, ttl uint32, streamID uint16)
}

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

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 SubDocumentError

type SubDocumentError struct {
	InnerError error
	Index      int
}

SubDocumentError provides additional contextual information to sub-document specific errors. InnerError is always a KeyValueError.

func (SubDocumentError) Error

func (err SubDocumentError) Error() string

Error returns the string representation of this error.

func (SubDocumentError) Unwrap

func (err SubDocumentError) Unwrap() error

Unwrap returns the underlying error for the operation failing.

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 TouchExCallback

type TouchExCallback func(*TouchResult, error)

TouchExCallback is invoked upon completion of a TouchEx operation.

type TouchOptions

type TouchOptions struct {
	Key            []byte
	Expiry         uint32
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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 UnlockExCallback

type UnlockExCallback func(*UnlockResult, error)

UnlockExCallback is invoked upon completion of a UnlockEx operation.

type UnlockOptions

type UnlockOptions struct {
	Key            []byte
	Cas            Cas
	CollectionName string
	ScopeName      string
	CollectionID   uint32
	RetryStrategy  RetryStrategy

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

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.

type ViewError

type ViewError struct {
	InnerError         error                `json:"-"`
	DesignDocumentName string               `json:"design_document_name,omitempty"`
	ViewName           string               `json:"view_name,omitempty"`
	Errors             []ViewQueryErrorDesc `json:"errors,omitempty"`
	Endpoint           string               `json:"endpoint,omitempty"`
	RetryReasons       []RetryReason        `json:"retry_reasons,omitempty"`
	RetryAttempts      uint32               `json:"retry_attempts,omitempty"`
}

ViewError represents an error returned from a view query.

func (ViewError) Error

func (e ViewError) Error() string

Error returns the string representation of this error.

func (ViewError) Unwrap

func (e ViewError) Unwrap() error

Unwrap returns the underlying reason for the error

type ViewQueryErrorDesc

type ViewQueryErrorDesc struct {
	SourceNode string
	Message    string
}

ViewQueryErrorDesc represents specific view error data.

type ViewQueryOptions

type ViewQueryOptions struct {
	DesignDocumentName string
	ViewType           string
	ViewName           string
	Options            url.Values
	RetryStrategy      RetryStrategy
	Deadline           time.Time

	// Volatile: Tracer API is subject to change.
	TraceContext RequestSpanContext
}

ViewQueryOptions represents the various options available for a view query.

type ViewQueryRowReader

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

ViewQueryRowReader providers access to the rows of a view query

func (*ViewQueryRowReader) Close

func (q *ViewQueryRowReader) Close() error

Close immediately shuts down the connection

func (ViewQueryRowReader) Err

func (q ViewQueryRowReader) Err() error

Err returns any errors that occurred during streaming.

func (*ViewQueryRowReader) MetaData

func (q *ViewQueryRowReader) MetaData() ([]byte, error)

MetaData fetches the non-row bytes streamed in the response.

func (*ViewQueryRowReader) NextRow

func (q *ViewQueryRowReader) NextRow() []byte

NextRow reads the next rows bytes from the stream

type WithDurationRetryAction

type WithDurationRetryAction struct {
	WithDuration time.Duration
}

WithDurationRetryAction represents an action that indicates to retry with a given duration.

func (*WithDurationRetryAction) Duration

func (ra *WithDurationRetryAction) Duration() time.Duration

Duration is the length of time to wait before retrying an operation.

Jump to

Keyboard shortcuts

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