gocb

package module
v2.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 26 Imported by: 139

README

GoDoc

Couchbase Go Client

The Go SDK library allows you to connect to a Couchbase cluster from Go. It is written in pure Go, and uses the included gocbcore library to handle communicating to the cluster over the Couchbase binary protocol.

Source

The project source is hosted at https://github.com/couchbase/gocb.

Documentation

You can explore our API reference through godoc at https://pkg.go.dev/github.com/couchbase/gocb.

You can also find documentation for the Go SDK on the official Couchbase docs.

Bug Tracker

Issues are tracked on Couchbase's public issues.couchbase.com. Contact the site admins regarding login or other problems at issues.couchbase.com (officially) or ask around on the forum (unofficially).

Discussion

You can chat with us on Discord or the official Couchbase forums.

Installing

To install the latest stable version, run:

go get github.com/couchbase/gocb/v2@latest

To install the latest developer version, run:

go get github.com/couchbase/gocb/v2@master

Testing

You can run tests in the usual Go way:

go test -race ./...

Which will execute both the unit test suite and the integration test suite. By default, the integration test suite is run against a mock Couchbase Server. See the testmain_test.go file for information on command line arguments for running tests against a real server instance.

Release train

Releases are targeted for every third Tuesday of the month. This is subject to change based on priorities.

Linting

Linting is performed used golangci-lint. To run:

make lint

License

Copyright 2016 Couchbase Inc.

Licensed under the Apache License, Version 2.0.

See LICENSE for further details.

Documentation

Overview

nolint: unused

nolint: unused

Index

Constants

View Source
const (
	// TransactionAttemptStateNothingWritten indicates that nothing has been written in this attempt.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStateNothingWritten = TransactionAttemptState(gocbcore.TransactionAttemptStateNothingWritten)

	// TransactionAttemptStatePending indicates that this attempt is in pending state.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStatePending = TransactionAttemptState(gocbcore.TransactionAttemptStatePending)

	// TransactionAttemptStateCommitting indicates that this attempt is in committing state.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStateCommitting = TransactionAttemptState(gocbcore.TransactionAttemptStateCommitting)

	// TransactionAttemptStateCommitted indicates that this attempt is in committed state.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStateCommitted = TransactionAttemptState(gocbcore.TransactionAttemptStateCommitted)

	// TransactionAttemptStateCompleted indicates that this attempt is in completed state.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStateCompleted = TransactionAttemptState(gocbcore.TransactionAttemptStateCompleted)

	// TransactionAttemptStateAborted indicates that this attempt is in aborted state.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStateAborted = TransactionAttemptState(gocbcore.TransactionAttemptStateAborted)

	// TransactionAttemptStateRolledBack indicates that this attempt is in rolled back state.
	// Internal: This should never be used and is not supported.
	TransactionAttemptStateRolledBack = TransactionAttemptState(gocbcore.TransactionAttemptStateRolledBack)
)
View Source
const (
	// TransactionErrorReasonSuccess indicates the transaction succeeded and did not fail.
	TransactionErrorReasonSuccess TransactionErrorReason = TransactionErrorReason(gocbcore.TransactionErrorReasonSuccess)

	// TransactionErrorReasonTransactionFailed indicates the transaction should be failed because it failed.
	TransactionErrorReasonTransactionFailed = TransactionErrorReason(gocbcore.TransactionErrorReasonTransactionFailed)

	// TransactionErrorReasonTransactionExpired indicates the transaction should be failed because it expired.
	TransactionErrorReasonTransactionExpired = TransactionErrorReason(gocbcore.TransactionErrorReasonTransactionExpired)

	// TransactionErrorReasonTransactionCommitAmbiguous indicates the transaction should be failed and the commit was ambiguous.
	TransactionErrorReasonTransactionCommitAmbiguous = TransactionErrorReason(gocbcore.TransactionErrorReasonTransactionCommitAmbiguous)

	// TransactionErrorReasonTransactionFailedPostCommit indicates the transaction should be failed because it failed post commit.
	TransactionErrorReasonTransactionFailedPostCommit = TransactionErrorReason(gocbcore.TransactionErrorReasonTransactionFailedPostCommit)
)

Variables

View Source
var (
	// ErrTimeout occurs when an operation does not receive a response in a timely manner.
	ErrTimeout = gocbcore.ErrTimeout

	// ErrRequestCanceled occurs when an operation has been canceled.
	ErrRequestCanceled = gocbcore.ErrRequestCanceled

	// ErrInvalidArgument occurs when an invalid argument is provided for an operation.
	ErrInvalidArgument = gocbcore.ErrInvalidArgument

	// ErrServiceNotAvailable occurs when the requested service is not available.
	ErrServiceNotAvailable = gocbcore.ErrServiceNotAvailable

	// ErrInternalServerFailure occurs when the server encounters an internal server error.
	ErrInternalServerFailure = gocbcore.ErrInternalServerFailure

	// ErrAuthenticationFailure occurs when authentication has failed.
	ErrAuthenticationFailure = gocbcore.ErrAuthenticationFailure

	// ErrTemporaryFailure occurs when an operation has failed for a reason that is temporary.
	ErrTemporaryFailure = gocbcore.ErrTemporaryFailure

	// ErrParsingFailure occurs when a query has failed to be parsed by the server.
	ErrParsingFailure = gocbcore.ErrParsingFailure

	// ErrCasMismatch occurs when an operation has been performed with a cas value that does not the value on the server.
	ErrCasMismatch = gocbcore.ErrCasMismatch

	// ErrBucketNotFound occurs when the requested bucket could not be found.
	ErrBucketNotFound = gocbcore.ErrBucketNotFound

	// ErrCollectionNotFound occurs when the requested collection could not be found.
	ErrCollectionNotFound = gocbcore.ErrCollectionNotFound

	// ErrEncodingFailure occurs when encoding of a value failed.
	ErrEncodingFailure = gocbcore.ErrEncodingFailure

	// ErrDecodingFailure occurs when decoding of a value failed.
	ErrDecodingFailure = gocbcore.ErrDecodingFailure

	// ErrUnsupportedOperation occurs when an operation that is unsupported or unknown is performed against the server.
	ErrUnsupportedOperation = gocbcore.ErrUnsupportedOperation

	// ErrAmbiguousTimeout occurs when an operation does not receive a response in a timely manner for a reason that
	//
	ErrAmbiguousTimeout = gocbcore.ErrAmbiguousTimeout

	// ErrAmbiguousTimeout occurs when an operation does not receive a response in a timely manner for a reason that
	// it can be safely established that
	ErrUnambiguousTimeout = gocbcore.ErrUnambiguousTimeout

	// ErrFeatureNotAvailable occurs when an operation is performed on a bucket which does not support it.
	ErrFeatureNotAvailable = gocbcore.ErrFeatureNotAvailable

	// ErrScopeNotFound occurs when the requested scope could not be found.
	ErrScopeNotFound = gocbcore.ErrScopeNotFound

	// ErrIndexNotFound occurs when the requested index could not be found.
	ErrIndexNotFound = gocbcore.ErrIndexNotFound

	// ErrIndexExists occurs when creating an index that already exists.
	ErrIndexExists = gocbcore.ErrIndexExists

	// ErrRateLimitedFailure occurs when a request is rate limited by the server.
	ErrRateLimitedFailure = gocbcore.ErrRateLimitedFailure

	// ErrQuotaLimitedFailure occurs when a request triggers a resource to exceed the allowed quota.
	ErrQuotaLimitedFailure = gocbcore.ErrQuotaLimitedFailure
)

Shared Error Definitions RFC#58@15

View Source
var (
	// ErrDocumentNotFound occurs when the requested document could not be found.
	ErrDocumentNotFound = gocbcore.ErrDocumentNotFound

	// ErrDocumentUnretrievable occurs when GetAnyReplica cannot find the document on any replica.
	ErrDocumentUnretrievable = gocbcore.ErrDocumentUnretrievable

	// ErrDocumentLocked occurs when a mutation operation is attempted against a document that is locked.
	ErrDocumentLocked = gocbcore.ErrDocumentLocked

	// ErrValueTooLarge occurs when a document has gone over the maximum size allowed by the server.
	ErrValueTooLarge = gocbcore.ErrValueTooLarge

	// ErrDocumentExists occurs when an attempt is made to insert a document but a document with that key already exists.
	ErrDocumentExists = gocbcore.ErrDocumentExists

	// ErrValueNotJSON occurs when a sub-document operation is performed on a
	// document which is not JSON.
	ErrValueNotJSON = gocbcore.ErrValueNotJSON

	// ErrDurabilityLevelNotAvailable occurs when an invalid durability level was requested.
	ErrDurabilityLevelNotAvailable = gocbcore.ErrDurabilityLevelNotAvailable

	// ErrDurabilityImpossible occurs when a request is performed with impossible
	// durability level requirements.
	ErrDurabilityImpossible = gocbcore.ErrDurabilityImpossible

	// ErrDurabilityAmbiguous occurs when an SyncWrite does not complete in the specified
	// time and the result is ambiguous.
	ErrDurabilityAmbiguous = gocbcore.ErrDurabilityAmbiguous

	// ErrDurableWriteInProgress occurs when an attempt is made to write to a key that has
	// a SyncWrite pending.
	ErrDurableWriteInProgress = gocbcore.ErrDurableWriteInProgress

	// ErrDurableWriteReCommitInProgress occurs when an SyncWrite is being recommitted.
	ErrDurableWriteReCommitInProgress = gocbcore.ErrDurableWriteReCommitInProgress

	// ErrMutationLost occurs when a mutation was lost.
	ErrMutationLost = gocbcore.ErrMutationLost

	// ErrPathNotFound occurs when a sub-document operation targets a path
	// which does not exist in the specified document.
	ErrPathNotFound = gocbcore.ErrPathNotFound

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

	// ErrPathInvalid occurs when a sub-document path could not be parsed.
	ErrPathInvalid = gocbcore.ErrPathInvalid

	// ErrPathTooBig occurs when a sub-document path is too big.
	ErrPathTooBig = gocbcore.ErrPathTooBig

	// ErrPathTooDeep occurs when an operation would cause a document to be
	// nested beyond the depth limits allowed by the sub-document specification.
	ErrPathTooDeep = gocbcore.ErrPathTooDeep

	// ErrValueTooDeep occurs when a sub-document operation specifies a value
	// which is deeper than the depth limits of the sub-document specification.
	ErrValueTooDeep = gocbcore.ErrValueTooDeep

	// ErrValueInvalid occurs when a sub-document operation could not insert.
	ErrValueInvalid = gocbcore.ErrValueInvalid

	// ErrDocumentNotJSON occurs when a sub-document operation is performed on a
	// document which is not JSON.
	ErrDocumentNotJSON = gocbcore.ErrDocumentNotJSON

	// ErrNumberTooBig occurs when a sub-document operation is performed with
	// a bad range.
	ErrNumberTooBig = gocbcore.ErrNumberTooBig

	// ErrDeltaInvalid occurs when a sub-document counter operation is performed
	// and the specified delta is not valid.
	ErrDeltaInvalid = gocbcore.ErrDeltaInvalid

	// ErrPathExists occurs when a sub-document operation expects a path not
	// to exists, but the path was found in the document.
	ErrPathExists = gocbcore.ErrPathExists

	// ErrXattrUnknownMacro occurs when an invalid macro value is specified.
	ErrXattrUnknownMacro = gocbcore.ErrXattrUnknownMacro

	// ErrXattrInvalidFlagCombo occurs when an invalid set of
	// extended-attribute flags is passed to a sub-document operation.
	ErrXattrInvalidFlagCombo = gocbcore.ErrXattrInvalidFlagCombo

	// ErrXattrInvalidKeyCombo occurs when an invalid set of key operations
	// are specified for a extended-attribute sub-document operation.
	ErrXattrInvalidKeyCombo = gocbcore.ErrXattrInvalidKeyCombo

	// ErrXattrUnknownVirtualAttribute occurs when an invalid virtual attribute is specified.
	ErrXattrUnknownVirtualAttribute = gocbcore.ErrXattrUnknownVirtualAttribute

	// ErrXattrCannotModifyVirtualAttribute occurs when a mutation is attempted upon
	// a virtual attribute (which are immutable by definition).
	ErrXattrCannotModifyVirtualAttribute = gocbcore.ErrXattrCannotModifyVirtualAttribute

	// ErrXattrInvalidOrder occurs when a set key key operations are specified for a extended-attribute sub-document
	// operation in the incorrect order.
	ErrXattrInvalidOrder = gocbcore.ErrXattrInvalidOrder
)

Key Value Error Definitions RFC#58@15

View Source
var (
	// ErrPlanningFailure occurs when the query service was unable to create a query plan.
	ErrPlanningFailure = gocbcore.ErrPlanningFailure

	// ErrIndexFailure occurs when there was an issue with the index specified.
	ErrIndexFailure = gocbcore.ErrIndexFailure

	// ErrPreparedStatementFailure occurs when there was an issue with the prepared statement.
	ErrPreparedStatementFailure = gocbcore.ErrPreparedStatementFailure
)

Query Error Definitions RFC#58@15

View Source
var (
	// ErrCompilationFailure occurs when there was an issue executing the analytics query because it could not
	// be compiled.
	ErrCompilationFailure = gocbcore.ErrCompilationFailure

	// ErrJobQueueFull occurs when the analytics service job queue is full.
	ErrJobQueueFull = gocbcore.ErrJobQueueFull

	// ErrDatasetNotFound occurs when the analytics dataset requested could not be found.
	ErrDatasetNotFound = gocbcore.ErrDatasetNotFound

	// ErrDataverseNotFound occurs when the analytics dataverse requested could not be found.
	ErrDataverseNotFound = gocbcore.ErrDataverseNotFound

	// ErrDatasetExists occurs when creating an analytics dataset failed because it already exists.
	ErrDatasetExists = gocbcore.ErrDatasetExists

	// ErrDataverseExists occurs when creating an analytics dataverse failed because it already exists.
	ErrDataverseExists = gocbcore.ErrDataverseExists

	// ErrLinkNotFound occurs when the analytics link requested could not be found.
	ErrLinkNotFound = gocbcore.ErrLinkNotFound

	// ErrAnalyticsLinkExists occurs when the analytics link already exists.
	ErrAnalyticsLinkExists = errors.New("analytics clink already exists")
)

Analytics Error Definitions RFC#58@15

View Source
var (
	// ErrViewNotFound occurs when the view requested could not be found.
	ErrViewNotFound = gocbcore.ErrViewNotFound

	// ErrDesignDocumentNotFound occurs when the design document requested could not be found.
	ErrDesignDocumentNotFound = gocbcore.ErrDesignDocumentNotFound
)

View Error Definitions RFC#58@15

View Source
var (
	// ErrCollectionExists occurs when creating a collection failed because it already exists.
	ErrCollectionExists = gocbcore.ErrCollectionExists

	// ErrScopeExists occurs when creating a scope failed because it already exists.
	ErrScopeExists = gocbcore.ErrScopeExists

	// ErrUserNotFound occurs when the user requested could not be found.
	ErrUserNotFound = gocbcore.ErrUserNotFound

	// ErrGroupNotFound occurs when the group requested could not be found.
	ErrGroupNotFound = gocbcore.ErrGroupNotFound

	// ErrBucketExists occurs when creating a bucket failed because it already exists.
	ErrBucketExists = gocbcore.ErrBucketExists

	// ErrUserExists occurs when creating a user failed because it already exists.
	ErrUserExists = gocbcore.ErrUserExists

	// ErrBucketNotFlushable occurs when a bucket could not be flushed because flushing is not enabled.
	ErrBucketNotFlushable = gocbcore.ErrBucketNotFlushable

	// ErrEventingFunctionNotFound occurs when the eventing function requested could not be found.
	ErrEventingFunctionNotFound = gocbcore.ErrEventingFunctionNotFound

	// ErrEventingFunctionNotDeployed occurs when the eventing function requested is not deployed.
	ErrEventingFunctionNotDeployed = gocbcore.ErrEventingFunctionNotDeployed

	// ErrEventingFunctionCompilationFailure occurs when the eventing function requested could not be compiled.
	ErrEventingFunctionCompilationFailure = gocbcore.ErrEventingFunctionCompilationFailure

	// ErrEventingFunctionIdenticalKeyspace occurs when the eventing function requested uses the same keyspace for source and metadata.
	ErrEventingFunctionIdenticalKeyspace = gocbcore.ErrEventingFunctionIdenticalKeyspace

	// ErrEventingFunctionNotBootstrapped occurs when the eventing function requested is not bootstrapped.
	ErrEventingFunctionNotBootstrapped = gocbcore.ErrEventingFunctionNotBootstrapped

	// ErrEventingFunctionDeployed occurs when the eventing function requested is not undeployed.
	ErrEventingFunctionDeployed = gocbcore.ErrEventingFunctionNotUndeployed
)

Management Error Definitions RFC#58@15

View Source
var (
	// ErrOverload occurs when too many operations are dispatched and all queues are full.
	ErrOverload = gocbcore.ErrOverload

	// ErrNoResult occurs when no results are available to a query.
	ErrNoResult = errors.New("no result was available")
)

SDK specific error definitions

View Source
var (
	// ErrOther indicates an non-specific error has occured.
	ErrOther = gocbcore.ErrOther

	// ErrTransient indicates a transient error occured which may succeed at a later point in time.
	ErrTransient = gocbcore.ErrTransient

	// ErrWriteWriteConflict indicates that another transaction conflicted with this one.
	ErrWriteWriteConflict = gocbcore.ErrWriteWriteConflict

	// ErrHard indicates that an unrecoverable error occured.
	ErrHard = gocbcore.ErrHard

	// ErrAmbiguous indicates that a failure occured but the outcome was not known.
	ErrAmbiguous = gocbcore.ErrAmbiguous

	// ErrAtrFull indicates that the ATR record was too full to accept a new mutation.
	ErrAtrFull = gocbcore.ErrAtrFull

	// ErrAttemptExpired indicates an transactionAttempt expired
	ErrAttemptExpired = gocbcore.ErrAttemptExpired

	// ErrAtrNotFound indicates that an expected ATR document was missing
	ErrAtrNotFound = gocbcore.ErrAtrNotFound

	// ErrAtrEntryNotFound indicates that an expected ATR entry was missing
	ErrAtrEntryNotFound = gocbcore.ErrAtrEntryNotFound

	// ErrDocAlreadyInTransaction indicates that a document is already in a transaction.
	ErrDocAlreadyInTransaction = gocbcore.ErrDocAlreadyInTransaction

	// ErrTransactionAbortedExternally indicates the transaction was aborted externally.
	ErrTransactionAbortedExternally = gocbcore.ErrTransactionAbortedExternally

	// ErrPreviousOperationFailed indicates a previous operation already failed.
	ErrPreviousOperationFailed = gocbcore.ErrPreviousOperationFailed

	// ErrForwardCompatibilityFailure indicates an operation failed due to involving a document in another transaction
	// which contains features this transaction does not support.
	ErrForwardCompatibilityFailure = gocbcore.ErrForwardCompatibilityFailure

	// ErrIllegalState is used for when a transaction enters an illegal State.
	ErrIllegalState = gocbcore.ErrIllegalState

	ErrAttemptNotFoundOnQuery = errors.New("transactionAttempt not found on query")
)
View Source
var (
	// UnknownRetryReason indicates that the operation failed for an unknown reason.
	UnknownRetryReason = RetryReason(gocbcore.UnknownRetryReason)

	// SocketNotAvailableRetryReason indicates that the operation failed because the underlying socket was not available.
	SocketNotAvailableRetryReason = RetryReason(gocbcore.SocketNotAvailableRetryReason)

	// ServiceNotAvailableRetryReason indicates that the operation failed because the requested service was not available.
	ServiceNotAvailableRetryReason = RetryReason(gocbcore.ServiceNotAvailableRetryReason)

	// NodeNotAvailableRetryReason indicates that the operation failed because the requested node was not available.
	NodeNotAvailableRetryReason = RetryReason(gocbcore.NodeNotAvailableRetryReason)

	// KVNotMyVBucketRetryReason indicates that the operation failed because it was sent to the wrong node for the vbucket.
	KVNotMyVBucketRetryReason = RetryReason(gocbcore.KVNotMyVBucketRetryReason)

	// KVCollectionOutdatedRetryReason indicates that the operation failed because the collection ID on the request is outdated.
	KVCollectionOutdatedRetryReason = RetryReason(gocbcore.KVCollectionOutdatedRetryReason)

	// KVErrMapRetryReason indicates that the operation failed for an unsupported reason but the KV error map indicated
	// that the operation can be retried.
	KVErrMapRetryReason = RetryReason(gocbcore.KVErrMapRetryReason)

	// KVLockedRetryReason indicates that the operation failed because the document was locked.
	KVLockedRetryReason = RetryReason(gocbcore.KVLockedRetryReason)

	// KVTemporaryFailureRetryReason indicates that the operation failed because of a temporary failure.
	KVTemporaryFailureRetryReason = RetryReason(gocbcore.KVTemporaryFailureRetryReason)

	// KVSyncWriteInProgressRetryReason indicates that the operation failed because a sync write is in progress.
	KVSyncWriteInProgressRetryReason = RetryReason(gocbcore.KVSyncWriteInProgressRetryReason)

	// KVSyncWriteRecommitInProgressRetryReason indicates that the operation failed because a sync write recommit is in progress.
	KVSyncWriteRecommitInProgressRetryReason = RetryReason(gocbcore.KVSyncWriteRecommitInProgressRetryReason)

	// ServiceResponseCodeIndicatedRetryReason indicates that the operation failed and the service responded stating that
	// the request should be retried.
	ServiceResponseCodeIndicatedRetryReason = RetryReason(gocbcore.ServiceResponseCodeIndicatedRetryReason)

	// SocketCloseInFlightRetryReason indicates that the operation failed because the socket was closed whilst the operation
	// was in flight.
	SocketCloseInFlightRetryReason = RetryReason(gocbcore.SocketCloseInFlightRetryReason)

	// CircuitBreakerOpenRetryReason indicates that the operation failed because the circuit breaker on the connection
	// was open.
	CircuitBreakerOpenRetryReason = RetryReason(gocbcore.CircuitBreakerOpenRetryReason)

	// QueryIndexNotFoundRetryReason indicates that the operation failed to to a missing query index
	QueryIndexNotFoundRetryReason = RetryReason(gocbcore.QueryIndexNotFoundRetryReason)

	// QueryPreparedStatementFailureRetryReason indicates that the operation failed due to a prepared statement failure
	QueryPreparedStatementFailureRetryReason = RetryReason(gocbcore.QueryPreparedStatementFailureRetryReason)

	// AnalyticsTemporaryFailureRetryReason indicates that an analytics operation failed due to a temporary failure
	AnalyticsTemporaryFailureRetryReason = RetryReason(gocbcore.AnalyticsTemporaryFailureRetryReason)

	// SearchTooManyRequestsRetryReason indicates that a search operation failed due to too many requests
	SearchTooManyRequestsRetryReason = RetryReason(gocbcore.SearchTooManyRequestsRetryReason)

	// QueryErrorRetryable indicates that the operation is retryable as indicated by the query engine.
	// Uncommitted: This API may change in the future.
	QueryErrorRetryable = RetryReason(gocbcore.QueryErrorRetryable)
)

Functions

func Identifier

func Identifier() string

Identifier returns a string representation of the current SDK identifier.

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 TransactionsProtocolExtensions added in v2.4.0

func TransactionsProtocolExtensions() []string

TransactionsProtocolExtensions returns a list strings representing the various features that this specific version of the library supports within its protocol version.

func TransactionsProtocolVersion added in v2.4.0

func TransactionsProtocolVersion() string

TransactionsProtocolVersion returns the protocol version that this library supports.

func Version

func Version() string

Version returns a string representation of the current SDK version.

Types

type AggregatingMeterOptions added in v2.3.0

type AggregatingMeterOptions struct {
	EmitInterval time.Duration
}

AggregatingMeterOptions is the set of options available when creating a LoggingMeter. Note that this function will soon be deprecated. Deprecated: See LoggingMeterOptions.

type AllowQueryingSearchIndexOptions

type AllowQueryingSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

AllowQueryingSearchIndexOptions is the set of options available to the search index AllowQuerying operation.

type AnalyticsDataset

type AnalyticsDataset struct {
	Name          string
	DataverseName string
	LinkName      string
	BucketName    string
}

AnalyticsDataset contains information about an analytics dataset.

type AnalyticsEncryptionLevel added in v2.3.0

type AnalyticsEncryptionLevel uint8
const (
	AnalyticsEncryptionLevelNone AnalyticsEncryptionLevel = iota
	AnalyticsEncryptionLevelHalf
	AnalyticsEncryptionLevelFull
)

func (AnalyticsEncryptionLevel) String added in v2.3.0

func (ael AnalyticsEncryptionLevel) String() string

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"`
	ErrorText       string               `json:"error_text,omitempty"`
	HTTPStatusCode  int                  `json:"http_status_code,omitempty"`
}

AnalyticsError is the error type of all analytics query errors. UNCOMMITTED: This API may change in the future.

func (AnalyticsError) Error

func (e AnalyticsError) Error() string

Error returns the string representation of this error.

func (AnalyticsError) MarshalJSON added in v2.2.1

func (e AnalyticsError) MarshalJSON() ([]byte, error)

func (AnalyticsError) Unwrap

func (e AnalyticsError) Unwrap() error

Unwrap returns the underlying cause for this error.

type AnalyticsErrorDesc

type AnalyticsErrorDesc struct {
	Code    uint32
	Message string
}

AnalyticsErrorDesc represents a specific error returned from the analytics service.

type AnalyticsIndex

type AnalyticsIndex struct {
	Name          string
	DatasetName   string
	DataverseName string
	IsPrimary     bool
}

AnalyticsIndex contains information about an analytics index.

type AnalyticsIndexManager

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

AnalyticsIndexManager provides methods for performing Couchbase Analytics index management.

ConnectLink connects an analytics link.

func (*AnalyticsIndexManager) CreateDataset

func (am *AnalyticsIndexManager) CreateDataset(datasetName, bucketName string, opts *CreateAnalyticsDatasetOptions) error

CreateDataset creates a new analytics dataset.

func (*AnalyticsIndexManager) CreateDataverse

func (am *AnalyticsIndexManager) CreateDataverse(dataverseName string, opts *CreateAnalyticsDataverseOptions) error

CreateDataverse creates a new analytics dataset.

func (*AnalyticsIndexManager) CreateIndex

func (am *AnalyticsIndexManager) CreateIndex(datasetName, indexName string, fields map[string]string, opts *CreateAnalyticsIndexOptions) error

CreateIndex creates a new analytics dataset.

CreateLink creates an analytics link.

DisconnectLink disconnects an analytics link.

func (*AnalyticsIndexManager) DropDataset

func (am *AnalyticsIndexManager) DropDataset(datasetName string, opts *DropAnalyticsDatasetOptions) error

DropDataset drops an analytics dataset.

func (*AnalyticsIndexManager) DropDataverse

func (am *AnalyticsIndexManager) DropDataverse(dataverseName string, opts *DropAnalyticsDataverseOptions) error

DropDataverse drops an analytics dataset.

func (*AnalyticsIndexManager) DropIndex

func (am *AnalyticsIndexManager) DropIndex(datasetName, indexName string, opts *DropAnalyticsIndexOptions) error

DropIndex drops an analytics index.

func (am *AnalyticsIndexManager) DropLink(linkName, dataverseName string, opts *DropAnalyticsLinkOptions) error

DropLink removes an existing external analytics link from specified scope. dataverseName can be given in the form of "namepart" or "namepart1/namepart2". Only available against Couchbase Server 7.0+.

func (*AnalyticsIndexManager) GetAllDatasets

GetAllDatasets gets all analytics datasets.

func (*AnalyticsIndexManager) GetAllIndexes

GetAllIndexes gets all analytics indexes.

GetLinks retrieves all external or remote analytics links.

func (*AnalyticsIndexManager) GetPendingMutations

func (am *AnalyticsIndexManager) GetPendingMutations(opts *GetPendingMutationsAnalyticsOptions) (map[string]map[string]int, error)

GetPendingMutations returns the number of pending mutations for all indexes in the form of dataverse.dataset:mutations.

ReplaceLink modifies an existing analytics link.

type AnalyticsLink interface {
	// Name returns the name of this link.
	Name() string
	// DataverseName returns the name of the dataverse that this link belongs to.
	DataverseName() string
	// FormEncode encodes the link into a form data representation, to be sent as the body of a CreateLink or ReplaceLink
	// request.
	FormEncode() ([]byte, error)
	// Validate is used by CreateLink and ReplaceLink to ensure that the link is valid.
	Validate() error
	// LinkType returns the type of analytics type this link is.
	LinkType() AnalyticsLinkType
}

AnalyticsLink describes an external or remote analytics link, used to access data external to the cluster.

type AnalyticsLinkType added in v2.3.0

type AnalyticsLinkType string
const (
	AnalyticsLinkTypeS3External      AnalyticsLinkType = "s3"
	AnalyticsLinkTypeAzureExternal   AnalyticsLinkType = "azureblob"
	AnalyticsLinkTypeCouchbaseRemote AnalyticsLinkType = "couchbase"
)

type AnalyticsMetaData

type AnalyticsMetaData struct {
	RequestID       string
	ClientContextID string
	Metrics         AnalyticsMetrics
	Signature       interface{}
	Warnings        []AnalyticsWarning
}

AnalyticsMetaData provides access to the meta-data properties of a query result.

type AnalyticsMetrics

type AnalyticsMetrics struct {
	ElapsedTime      time.Duration
	ExecutionTime    time.Duration
	ResultCount      uint64
	ResultSize       uint64
	MutationCount    uint64
	SortCount        uint64
	ErrorCount       uint64
	WarningCount     uint64
	ProcessedObjects uint64
}

AnalyticsMetrics encapsulates various metrics gathered during a queries execution.

type AnalyticsOptions

type AnalyticsOptions struct {
	// ClientContextID provides a unique ID for this query which can be used matching up requests between connectionManager and
	// server. If not provided will be assigned a uuid value.
	ClientContextID string

	// Priority sets whether this query should be assigned as high priority by the analytics engine.
	Priority             bool
	PositionalParameters []interface{}
	NamedParameters      map[string]interface{}
	Readonly             bool
	ScanConsistency      AnalyticsScanConsistency

	// Raw provides a way to provide extra parameters in the request body for the query.
	Raw map[string]interface{}

	Timeout       time.Duration
	RetryStrategy RetryStrategy

	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

AnalyticsOptions is the set of options available to an Analytics query.

type AnalyticsResult

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

AnalyticsResult allows access to the results of a query.

func (*AnalyticsResult) Close

func (r *AnalyticsResult) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*AnalyticsResult) Err

func (r *AnalyticsResult) Err() error

Err returns any errors that have occurred on the stream

func (*AnalyticsResult) MetaData

func (r *AnalyticsResult) MetaData() (*AnalyticsMetaData, error)

MetaData returns any meta-data that was available from this query. Note that the meta-data will only be available once the object has been closed (either implicitly or explicitly).

func (*AnalyticsResult) Next

func (r *AnalyticsResult) Next() bool

Next assigns the next result from the results into the value pointer, returning whether the read was successful.

func (*AnalyticsResult) One

func (r *AnalyticsResult) One(valuePtr interface{}) error

One assigns the first value from the results into the value pointer. It will close the results but not before iterating through all remaining results, as such this should only be used for very small resultsets - ideally of, at most, length 1.

func (*AnalyticsResult) Raw added in v2.2.0

Raw returns a AnalyticsResult which can be used to access the raw byte data from search queries. Calling this function invalidates the underlying AnalyticsResult which will no longer be able to be used. VOLATILE: This API is subject to change at any time.

func (*AnalyticsResult) Row

func (r *AnalyticsResult) Row(valuePtr interface{}) error

Row returns the value of the current row

type AnalyticsResultRaw added in v2.2.0

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

AnalyticsResultRaw provides raw access to analytics query data. VOLATILE: This API is subject to change at any time.

func (*AnalyticsResultRaw) Close added in v2.2.0

func (arr *AnalyticsResultRaw) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*AnalyticsResultRaw) Err added in v2.2.0

func (arr *AnalyticsResultRaw) Err() error

Err returns any errors that have occurred on the stream

func (*AnalyticsResultRaw) MetaData added in v2.2.0

func (arr *AnalyticsResultRaw) MetaData() ([]byte, error)

MetaData returns any meta-data that was available from this query as bytes.

func (*AnalyticsResultRaw) NextBytes added in v2.2.0

func (arr *AnalyticsResultRaw) NextBytes() []byte

NextBytes returns the next row as bytes.

type AnalyticsScanConsistency

type AnalyticsScanConsistency uint

AnalyticsScanConsistency indicates the level of data consistency desired for an analytics query.

const (
	// AnalyticsScanConsistencyNotBounded indicates no data consistency is required.
	AnalyticsScanConsistencyNotBounded AnalyticsScanConsistency = iota + 1
	// AnalyticsScanConsistencyRequestPlus indicates that request-level data consistency is required.
	AnalyticsScanConsistencyRequestPlus
)

type AnalyticsWarning

type AnalyticsWarning struct {
	Code    uint32
	Message string
}

AnalyticsWarning encapsulates any warnings returned by a query.

type AnalyzeDocumentOptions

type AnalyzeDocumentOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

AnalyzeDocumentOptions is the set of options available to the search index AnalyzeDocument operation.

type AppendOp

type AppendOp struct {
	ID     string
	Value  string
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

AppendOp represents a type of `BulkOp` used for Append operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type AppendOptions

type AppendOptions struct {
	Timeout         time.Duration
	DurabilityLevel DurabilityLevel
	PersistTo       uint
	ReplicateTo     uint
	Cas             Cas
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

AppendOptions are the options available to the Append operation.

type ArrayAddUniqueSpecOptions

type ArrayAddUniqueSpecOptions struct {
	CreatePath bool
	IsXattr    bool
}

ArrayAddUniqueSpecOptions are the options available to subdocument ArrayAddUnique operations.

type ArrayAppendSpecOptions

type ArrayAppendSpecOptions struct {
	CreatePath bool
	IsXattr    bool
	// HasMultiple adds multiple values as elements to an array.
	// When used `value` in the spec must be an array type
	// ArrayAppend("path", []int{1,2,3,4}, ArrayAppendSpecOptions{HasMultiple:true}) =>
	//   "path" [..., 1,2,3,4]
	//
	// This is a more efficient version (at both the network and server levels)
	// of doing
	// spec.ArrayAppend("path", 1, nil)
	// spec.ArrayAppend("path", 2, nil)
	// spec.ArrayAppend("path", 3, nil)
	HasMultiple bool
}

ArrayAppendSpecOptions are the options available to subdocument ArrayAppend operations.

type ArrayInsertSpecOptions

type ArrayInsertSpecOptions struct {
	CreatePath bool
	IsXattr    bool
	// HasMultiple adds multiple values as elements to an array.
	// When used `value` in the spec must be an array type
	// ArrayInsert("path[1]", []int{1,2,3,4}, ArrayInsertSpecOptions{HasMultiple:true}) =>
	//   "path" [..., 1,2,3,4]
	//
	// This is a more efficient version (at both the network and server levels)
	// of doing
	// spec.ArrayInsert("path[2]", 1, nil)
	// spec.ArrayInsert("path[3]", 2, nil)
	// spec.ArrayInsert("path[4]", 3, nil)
	HasMultiple bool
}

ArrayInsertSpecOptions are the options available to subdocument ArrayInsert operations.

type ArrayPrependSpecOptions

type ArrayPrependSpecOptions struct {
	CreatePath bool
	IsXattr    bool
	// HasMultiple adds multiple values as elements to an array.
	// When used `value` in the spec must be an array type
	// ArrayPrepend("path", []int{1,2,3,4}, ArrayPrependSpecOptions{HasMultiple:true}) =>
	//   "path" [1,2,3,4, ....]
	//
	// This is a more efficient version (at both the network and server levels)
	// of doing
	// spec.ArrayPrepend("path", 1, nil)
	// spec.ArrayPrepend("path", 2, nil)
	// spec.ArrayPrepend("path", 3, nil)
	HasMultiple bool
}

ArrayPrependSpecOptions are the options available to subdocument ArrayPrepend operations.

type AttemptFunc added in v2.4.0

type AttemptFunc func(*TransactionAttemptContext) error

AttemptFunc represents the lambda used by the Transactions Run function.

type AuthCertRequest

type AuthCertRequest struct {
	Service  ServiceType
	Endpoint string
}

AuthCertRequest encapsulates the data for a certificate request from the new Authenticator interface. VOLATILE: This API is subject to change at any time.

type AuthCredsRequest

type AuthCredsRequest struct {
	Service  ServiceType
	Endpoint string
}

AuthCredsRequest encapsulates the data for a credential request from the new Authenticator interface. VOLATILE: This API is subject to change at any time.

type AuthDomain

type AuthDomain string

AuthDomain specifies the user domain of a specific user

const (
	// LocalDomain specifies users that are locally stored in Couchbase.
	LocalDomain AuthDomain = "local"

	// ExternalDomain specifies users that are externally stored
	// (in LDAP for instance).
	ExternalDomain AuthDomain = "external"
)

type Authenticator

type Authenticator interface {
	// VOLATILE: This API is subject to change at any time.
	SupportsTLS() bool

	// VOLATILE: This API is subject to change at any time.
	SupportsNonTLS() bool

	// VOLATILE: This API is subject to change at any time.
	Certificate(req AuthCertRequest) (*tls.Certificate, error)

	// VOLATILE: This API is subject to change at any time.
	Credentials(req AuthCredsRequest) ([]UserPassPair, error)
}

Authenticator provides an interface to authenticate to each service. Note that only authenticators implemented via the SDK are stable.

type AzureBlobExternalAnalyticsLink struct {
	Dataverse             string
	LinkName              string
	ConnectionString      string
	AccountName           string
	AccountKey            string
	SharedAccessSignature string
	BlobEndpoint          string
	EndpointSuffix        string
}

AzureBlobExternalAnalyticsLink describes an external analytics link which uses the Microsoft Azure Blob Storage service. Only available as of 7.0 Developer Preview. VOLATILE: This API is subject to change at any time.

func NewAzureBlobExternalAnalyticsLink(linkName, dataverseName string,
	opts *NewAzureBlobExternalAnalyticsLinkOptions) *AzureBlobExternalAnalyticsLink

NewAzureBlobExternalAnalyticsLink creates a new AzureBlobExternalAnalyticsLink. VOLATILE: This API is subject to change at any time.

func (*AzureBlobExternalAnalyticsLink) DataverseName added in v2.3.0

func (al *AzureBlobExternalAnalyticsLink) DataverseName() string

DataverseName returns the name of the dataverse that this link belongs to.

func (*AzureBlobExternalAnalyticsLink) FormEncode added in v2.3.0

func (al *AzureBlobExternalAnalyticsLink) FormEncode() ([]byte, error)

FormEncode encodes the link into a form data representation, to sent as the body of a CreateLink or ReplaceLink request.

func (*AzureBlobExternalAnalyticsLink) LinkType added in v2.3.0

LinkType returns the type of analytics type this link is: AnalyticsLinkTypeAzureExternal.

func (*AzureBlobExternalAnalyticsLink) Name added in v2.3.0

Name returns the name of this link.

func (*AzureBlobExternalAnalyticsLink) Validate added in v2.3.0

func (al *AzureBlobExternalAnalyticsLink) Validate() error

Validate is used by CreateLink and ReplaceLink to ensure that the link is valid.

type BackoffCalculator

type BackoffCalculator func(retryAttempts uint32) time.Duration

BackoffCalculator defines how backoff durations will be calculated by the retry API.

type BestEffortRetryStrategy

type BestEffortRetryStrategy struct {
	BackoffCalculator BackoffCalculator
}

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 a controlled backoff 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 BinaryCollection

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

BinaryCollection is a set of binary operations.

func (*BinaryCollection) Append

func (c *BinaryCollection) Append(id string, val []byte, opts *AppendOptions) (mutOut *MutationResult, errOut error)

Append appends a byte value to a document.

func (*BinaryCollection) Decrement

func (c *BinaryCollection) Decrement(id string, opts *DecrementOptions) (countOut *CounterResult, errOut error)

Decrement performs an atomic subtraction for an integer document. Passing a non-negative `initial` value will cause the document to be created if it did not already exist.

func (*BinaryCollection) Increment

func (c *BinaryCollection) Increment(id string, opts *IncrementOptions) (countOut *CounterResult, errOut error)

Increment performs an atomic addition for an integer document. Passing a non-negative `initial` value will cause the document to be created if it did not already exist.

func (*BinaryCollection) Prepend

func (c *BinaryCollection) Prepend(id string, val []byte, opts *PrependOptions) (mutOut *MutationResult, errOut error)

Prepend prepends a byte value to a document.

type Bucket

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

Bucket represents a single bucket within a cluster.

func (*Bucket) Collection

func (b *Bucket) Collection(collectionName string) *Collection

Collection returns an instance of a collection from within the default scope.

func (*Bucket) Collections

func (b *Bucket) Collections() *CollectionManager

Collections provides functions for managing collections.

func (*Bucket) DefaultCollection

func (b *Bucket) DefaultCollection() *Collection

DefaultCollection returns an instance of the default collection.

func (*Bucket) DefaultScope

func (b *Bucket) DefaultScope() *Scope

DefaultScope returns an instance of the default scope.

func (*Bucket) Internal added in v2.1.4

func (b *Bucket) Internal() *InternalBucket

Internal returns an InternalBucket. Internal: This should never be used and is not supported.

func (*Bucket) Name

func (b *Bucket) Name() string

Name returns the name of the bucket.

func (*Bucket) Ping

func (b *Bucket) Ping(opts *PingOptions) (*PingResult, error)

Ping will ping a list of services and verify they are active and responding in an acceptable period of time.

func (*Bucket) Scope

func (b *Bucket) Scope(scopeName string) *Scope

Scope returns an instance of a Scope.

func (*Bucket) ViewIndexes

func (b *Bucket) ViewIndexes() *ViewIndexManager

ViewIndexes returns a ViewIndexManager instance for managing views.

func (*Bucket) ViewQuery

func (b *Bucket) ViewQuery(designDoc string, viewName string, opts *ViewOptions) (*ViewResult, error)

ViewQuery performs a view query and returns a list of rows or an error.

func (*Bucket) WaitUntilReady added in v2.1.0

func (b *Bucket) WaitUntilReady(timeout time.Duration, opts *WaitUntilReadyOptions) error

WaitUntilReady will wait for the bucket object to be ready for use. At present this will wait until memd connections have been established with the server and are ready to be used before performing a ping against the specified services (except KeyValue) which also exist in the cluster map. If no services are specified then will wait until KeyValue is ready. Valid service types are: ServiceTypeKeyValue, ServiceTypeManagement, ServiceTypeQuery, ServiceTypeSearch, ServiceTypeAnalytics, ServiceTypeViews.

type BucketManager

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

BucketManager provides methods for performing bucket management operations. See BucketManager for methods that allow creating and removing buckets themselves.

func (*BucketManager) CreateBucket

func (bm *BucketManager) CreateBucket(settings CreateBucketSettings, opts *CreateBucketOptions) error

CreateBucket creates a bucket on the cluster.

func (*BucketManager) DropBucket

func (bm *BucketManager) DropBucket(name string, opts *DropBucketOptions) error

DropBucket will delete a bucket from the cluster by name.

func (*BucketManager) FlushBucket

func (bm *BucketManager) FlushBucket(name string, opts *FlushBucketOptions) error

FlushBucket will delete all the of the data from a bucket. Keep in mind that you must have flushing enabled in the buckets configuration.

func (*BucketManager) GetAllBuckets

func (bm *BucketManager) GetAllBuckets(opts *GetAllBucketsOptions) (map[string]BucketSettings, error)

GetAllBuckets returns a list of all active buckets on the cluster.

func (*BucketManager) GetBucket

func (bm *BucketManager) GetBucket(bucketName string, opts *GetBucketOptions) (*BucketSettings, error)

GetBucket returns settings for a bucket on the cluster.

func (*BucketManager) UpdateBucket

func (bm *BucketManager) UpdateBucket(settings BucketSettings, opts *UpdateBucketOptions) error

UpdateBucket updates a bucket on the cluster.

type BucketSettings

type BucketSettings struct {
	Name                 string
	FlushEnabled         bool
	ReplicaIndexDisabled bool // inverted so that zero value matches server default.
	RAMQuotaMB           uint64
	NumReplicas          uint32     // NOTE: If not set this will set 0 replicas.
	BucketType           BucketType // Defaults to CouchbaseBucketType.
	EvictionPolicy       EvictionPolicyType
	// Deprecated: Use MaxExpiry instead.
	MaxTTL                 time.Duration
	MaxExpiry              time.Duration
	CompressionMode        CompressionMode
	MinimumDurabilityLevel DurabilityLevel
	StorageBackend         StorageBackend
}

BucketSettings holds information about the settings for a bucket.

type BucketType

type BucketType string

BucketType specifies the kind of bucket.

const (
	// CouchbaseBucketType indicates a Couchbase bucket type.
	CouchbaseBucketType BucketType = "membase"

	// MemcachedBucketType indicates a Memcached bucket type.
	MemcachedBucketType BucketType = "memcached"

	// EphemeralBucketType indicates an Ephemeral bucket type.
	EphemeralBucketType BucketType = "ephemeral"
)

type BuildDeferredQueryIndexOptions

type BuildDeferredQueryIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

BuildDeferredQueryIndexOptions is the set of options available to the query indexes BuildDeferredIndexes operation.

type BulkOp

type BulkOp interface {
	// contains filtered or unexported methods
}

BulkOp represents a single operation that can be submitted (within a list of more operations) to .Do() You can create a bulk operation by instantiating one of the implementations of BulkOp, such as GetOp, UpsertOp, ReplaceOp, and more. UNCOMMITTED: This API may change in the future.

type BulkOpOptions

type BulkOpOptions struct {
	Timeout       time.Duration
	Transcoder    Transcoder
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

BulkOpOptions are the set of options available when performing BulkOps using Do.

type Capability added in v2.2.2

type Capability uint32

Capability represents a server capability. Internal: This should never be used and is not supported.

const (
	CapabilityDurableWrites Capability = iota + 1
	CapabilityCreateAsDeleted
	CapabilityReplaceBodyWithXattr
)

type CapabilityStatus added in v2.2.2

type CapabilityStatus uint32

CapabilityStatus represents a status for a server capability. Internal: This should never be used and is not supported.

type Cas

type Cas gocbcore.Cas

Cas represents the specific state of a document on the cluster.

type CertificateAuthenticator

type CertificateAuthenticator struct {
	ClientCertificate *tls.Certificate
}

CertificateAuthenticator implements an Authenticator which can be used with certificate authentication.

func (CertificateAuthenticator) Certificate

Certificate returns the certificate to use when connecting to a specified server. VOLATILE: This API is subject to change at any time.

func (CertificateAuthenticator) Credentials

Credentials returns the credentials for a particular service. VOLATILE: This API is subject to change at any time.

func (CertificateAuthenticator) SupportsNonTLS

func (ca CertificateAuthenticator) SupportsNonTLS() bool

SupportsNonTLS returns whether this authenticator can authenticate a non-TLS connection. VOLATILE: This API is subject to change at any time.

func (CertificateAuthenticator) SupportsTLS

func (ca CertificateAuthenticator) SupportsTLS() bool

SupportsTLS returns whether this authenticator can authenticate a TLS connection. VOLATILE: This API is subject to change at any time.

type ChangePasswordOptions added in v2.5.1

type ChangePasswordOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

ChangePasswordOptions is the set of options available to the user manager ChangePassword operation. UNCOMMITTED: This API may change in the future.

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 {
	Disabled                 bool
	VolumeThreshold          int64
	ErrorThresholdPercentage float64
	SleepWindow              time.Duration
	RollingWindow            time.Duration
	CompletionCallback       CircuitBreakerCallback
	CanaryTimeout            time.Duration
}

CircuitBreakerConfig are the settings for configuring circuit breakers.

type Cluster

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

Cluster represents a connection to a specific Couchbase cluster.

func Connect

func Connect(connStr string, opts ClusterOptions) (*Cluster, error)

Connect creates and returns a Cluster instance created using the provided options and a connection string.

func (*Cluster) AnalyticsIndexes

func (c *Cluster) AnalyticsIndexes() *AnalyticsIndexManager

AnalyticsIndexes returns an AnalyticsIndexManager for managing analytics indexes.

func (*Cluster) AnalyticsQuery

func (c *Cluster) AnalyticsQuery(statement string, opts *AnalyticsOptions) (*AnalyticsResult, error)

AnalyticsQuery executes the analytics query statement on the server.

func (*Cluster) Bucket

func (c *Cluster) Bucket(bucketName string) *Bucket

Bucket connects the cluster to server(s) and returns a new Bucket instance.

func (*Cluster) Buckets

func (c *Cluster) Buckets() *BucketManager

Buckets returns a BucketManager for managing buckets.

func (*Cluster) Close

func (c *Cluster) Close(opts *ClusterCloseOptions) error

Close shuts down all buckets in this cluster and invalidates any references this cluster has.

func (*Cluster) Diagnostics

func (c *Cluster) Diagnostics(opts *DiagnosticsOptions) (*DiagnosticsResult, error)

Diagnostics returns information about the internal state of the SDK.

func (*Cluster) EventingFunctions added in v2.3.2

func (c *Cluster) EventingFunctions() *EventingFunctionManager

EventingFunctions returns a EventingFunctionManager for managing eventing functions. UNCOMMITTED: This API may change in the future.

func (*Cluster) Internal added in v2.4.1

func (c *Cluster) Internal() *InternalCluster

Internal returns an InternalCluster. Internal: This should never be used and is not supported.

func (*Cluster) Ping added in v2.0.3

func (c *Cluster) Ping(opts *PingOptions) (*PingResult, error)

Ping will ping a list of services and verify they are active and responding in an acceptable period of time.

func (*Cluster) Query

func (c *Cluster) Query(statement string, opts *QueryOptions) (*QueryResult, error)

Query executes the query statement on the server.

func (*Cluster) QueryIndexes

func (c *Cluster) QueryIndexes() *QueryIndexManager

QueryIndexes returns a QueryIndexManager for managing query indexes.

func (*Cluster) SearchIndexes

func (c *Cluster) SearchIndexes() *SearchIndexManager

SearchIndexes returns a SearchIndexManager for managing search indexes.

func (*Cluster) SearchQuery

func (c *Cluster) SearchQuery(indexName string, query cbsearch.Query, opts *SearchOptions) (*SearchResult, error)

SearchQuery executes the analytics query statement on the server.

func (*Cluster) Transactions added in v2.4.0

func (c *Cluster) Transactions() *Transactions

Transactions returns a Transactions instance for performing transactions.

func (*Cluster) Users

func (c *Cluster) Users() *UserManager

Users returns a UserManager for managing users.

func (*Cluster) WaitUntilReady added in v2.1.0

func (c *Cluster) WaitUntilReady(timeout time.Duration, opts *WaitUntilReadyOptions) error

WaitUntilReady will wait for the cluster object to be ready for use. At present this will wait until memd connections have been established with the server and are ready to be used before performing a ping against the specified services which also exist in the cluster map. If no services are specified then ServiceTypeManagement, ServiceTypeQuery, ServiceTypeSearch, ServiceTypeAnalytics will be pinged. Valid service types are: ServiceTypeManagement, ServiceTypeQuery, ServiceTypeSearch, ServiceTypeAnalytics.

type ClusterCloseOptions

type ClusterCloseOptions struct {
}

ClusterCloseOptions is the set of options available when disconnecting from a Cluster.

type ClusterConfigProfile added in v2.6.0

type ClusterConfigProfile string

ClusterConfigProfile represents a named profile that can be applied to ClusterOptions. VOLATILE: This API is subject to change at any time.

const (
	// ClusterConfigProfileWanDevelopment represents a wan development profile that can be applied to the ClusterOptions
	// overwriting any properties that exist on the profile.
	// VOLATILE: This API is subject to change at any time.
	ClusterConfigProfileWanDevelopment ClusterConfigProfile = "wan-development"
)

type ClusterOptions

type ClusterOptions struct {
	// Authenticator specifies the authenticator to use with the cluster.
	Authenticator Authenticator

	// Username & Password specifies the cluster username and password to
	// authenticate with.  This is equivalent to passing PasswordAuthenticator
	// as the Authenticator parameter with the same values.
	Username string
	Password string

	// Timeouts specifies various operation timeouts.
	TimeoutsConfig TimeoutsConfig

	// Transcoder is used for trancoding data used in KV operations.
	Transcoder Transcoder

	// RetryStrategy is used to automatically retry operations if they fail.
	RetryStrategy RetryStrategy

	// Tracer specifies the tracer to use for requests.
	Tracer RequestTracer

	Meter Meter

	// OrphanReporterConfig specifies options for the orphan reporter.
	OrphanReporterConfig OrphanReporterConfig

	// CircuitBreakerConfig specifies options for the circuit breakers.
	CircuitBreakerConfig CircuitBreakerConfig

	// IoConfig specifies IO related configuration options.
	IoConfig IoConfig

	// SecurityConfig specifies security related configuration options.
	SecurityConfig SecurityConfig

	// TransactionsConfig specifies transactions related configuration options.
	TransactionsConfig TransactionsConfig

	// CompressionConfig specifies compression related configuration options.
	CompressionConfig CompressionConfig

	// Internal: This should never be used and is not supported.
	InternalConfig InternalConfig
}

ClusterOptions is the set of options available for creating a Cluster.

func (*ClusterOptions) ApplyProfile added in v2.6.0

func (opts *ClusterOptions) ApplyProfile(profile ClusterConfigProfile) error

ApplyProfile will apply a named profile to the ClusterOptions overwriting any properties that exist on the profile. VOLATILE: This API is subject to change at any time.

type ClusterState

type ClusterState uint

ClusterState specifies the current state of the cluster

const (
	// ClusterStateOnline indicates that all nodes are online and reachable.
	ClusterStateOnline ClusterState = iota + 1

	// ClusterStateDegraded indicates that all services will function, but possibly not optimally.
	ClusterStateDegraded

	// ClusterStateOffline indicates that no nodes were reachable.
	ClusterStateOffline
)

type Collection

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

Collection represents a single collection.

func (*Collection) Binary

func (c *Collection) Binary() *BinaryCollection

Binary creates and returns a BinaryCollection object.

func (*Collection) Bucket added in v2.1.4

func (c *Collection) Bucket() *Bucket

Bucket returns the bucket to which this collection belongs. UNCOMMITTED: This API may change in the future.

func (*Collection) Do

func (c *Collection) Do(ops []BulkOp, opts *BulkOpOptions) error

Do execute one or more `BulkOp` items in parallel. UNCOMMITTED: This API may change in the future.

func (*Collection) Exists

func (c *Collection) Exists(id string, opts *ExistsOptions) (docOut *ExistsResult, errOut error)

Exists checks if a document exists for the given id.

func (*Collection) Get

func (c *Collection) Get(id string, opts *GetOptions) (docOut *GetResult, errOut error)

Get performs a fetch operation against the collection. This can take 3 paths, a standard full document fetch, a subdocument full document fetch also fetching document expiry (when WithExpiry is set), or a subdocument fetch (when Project is used).

func (*Collection) GetAllReplicas

func (c *Collection) GetAllReplicas(id string, opts *GetAllReplicaOptions) (docOut *GetAllReplicasResult, errOut error)

GetAllReplicas returns the value of a particular document from all replica servers. This will return an iterable which streams results one at a time.

func (*Collection) GetAndLock

func (c *Collection) GetAndLock(id string, lockTime time.Duration, opts *GetAndLockOptions) (docOut *GetResult, errOut error)

GetAndLock locks a document for a period of time, providing exclusive RW access to it. A lockTime value of over 30 seconds will be treated as 30 seconds. The resolution used to send this value to the server is seconds and is calculated using uint32(lockTime/time.Second).

func (*Collection) GetAndTouch

func (c *Collection) GetAndTouch(id string, expiry time.Duration, opts *GetAndTouchOptions) (docOut *GetResult, errOut error)

GetAndTouch retrieves a document and simultaneously updates its expiry time.

func (*Collection) GetAnyReplica

func (c *Collection) GetAnyReplica(id string, opts *GetAnyReplicaOptions) (docOut *GetReplicaResult, errOut error)

GetAnyReplica returns the value of a particular document from a replica server.

func (*Collection) Insert

func (c *Collection) Insert(id string, val interface{}, opts *InsertOptions) (mutOut *MutationResult, errOut error)

Insert creates a new document in the Collection.

func (*Collection) List

func (c *Collection) List(id string) *CouchbaseList

List returns a new CouchbaseList for the document specified by id.

func (*Collection) LookupIn

func (c *Collection) LookupIn(id string, ops []LookupInSpec, opts *LookupInOptions) (docOut *LookupInResult, errOut error)

LookupIn performs a set of subdocument lookup operations on the document identified by id.

func (*Collection) Map

func (c *Collection) Map(id string) *CouchbaseMap

Map returns a new CouchbaseMap.

func (*Collection) MutateIn

func (c *Collection) MutateIn(id string, ops []MutateInSpec, opts *MutateInOptions) (mutOut *MutateInResult, errOut error)

MutateIn performs a set of subdocument mutations on the document specified by id.

func (*Collection) Name

func (c *Collection) Name() string

Name returns the name of the collection.

func (*Collection) QueryIndexes added in v2.6.1

func (c *Collection) QueryIndexes() *CollectionQueryIndexManager

QueryIndexes returns a CollectionQueryIndexManager for managing query indexes. UNCOMMITTED: This API may change in the future.

func (*Collection) Queue

func (c *Collection) Queue(id string) *CouchbaseQueue

Queue returns a new CouchbaseQueue.

func (*Collection) Remove

func (c *Collection) Remove(id string, opts *RemoveOptions) (mutOut *MutationResult, errOut error)

Remove removes a document from the collection.

func (*Collection) Replace

func (c *Collection) Replace(id string, val interface{}, opts *ReplaceOptions) (mutOut *MutationResult, errOut error)

Replace updates a document in the collection.

func (*Collection) Scan added in v2.6.1

func (c *Collection) Scan(scanType ScanType, opts *ScanOptions) (*ScanResult, error)

Scan performs a scan across a Collection, returning a stream of documents. VOLATILE: This API is subject to change at any time.

func (*Collection) ScopeName added in v2.1.4

func (c *Collection) ScopeName() string

ScopeName returns the name of the scope to which this collection belongs.

func (*Collection) Set

func (c *Collection) Set(id string) *CouchbaseSet

Set returns a new CouchbaseSet.

func (*Collection) Touch

func (c *Collection) Touch(id string, expiry time.Duration, opts *TouchOptions) (mutOut *MutationResult, errOut error)

Touch touches a document, specifying a new expiry time for it.

func (*Collection) Unlock

func (c *Collection) Unlock(id string, cas Cas, opts *UnlockOptions) (errOut error)

Unlock unlocks a document which was locked with GetAndLock.

func (*Collection) Upsert

func (c *Collection) Upsert(id string, val interface{}, opts *UpsertOptions) (mutOut *MutationResult, errOut error)

Upsert creates a new document in the Collection if it does not exist, if it does exist then it updates it.

type CollectionManager

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

CollectionManager provides methods for performing collections management.

func (*CollectionManager) CreateCollection

func (cm *CollectionManager) CreateCollection(spec CollectionSpec, opts *CreateCollectionOptions) error

CreateCollection creates a new collection on the bucket.

func (*CollectionManager) CreateScope

func (cm *CollectionManager) CreateScope(scopeName string, opts *CreateScopeOptions) error

CreateScope creates a new scope on the bucket.

func (*CollectionManager) DropCollection

func (cm *CollectionManager) DropCollection(spec CollectionSpec, opts *DropCollectionOptions) error

DropCollection removes a collection.

func (*CollectionManager) DropScope

func (cm *CollectionManager) DropScope(scopeName string, opts *DropScopeOptions) error

DropScope removes a scope.

func (*CollectionManager) GetAllScopes

func (cm *CollectionManager) GetAllScopes(opts *GetAllScopesOptions) ([]ScopeSpec, error)

GetAllScopes gets all scopes from the bucket.

type CollectionQueryIndexManager added in v2.6.1

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

CollectionQueryIndexManager provides methods for performing Couchbase query index management against collections. UNCOMMITTED: This API may change in the future.

func (*CollectionQueryIndexManager) BuildDeferredIndexes added in v2.6.1

func (qm *CollectionQueryIndexManager) BuildDeferredIndexes(opts *BuildDeferredQueryIndexOptions) ([]string, error)

BuildDeferredIndexes builds all indexes which are currently in deferred state. If no collection and scope names are specified in the options then *only* indexes created on the bucket directly will be built.

func (*CollectionQueryIndexManager) CreateIndex added in v2.6.1

func (qm *CollectionQueryIndexManager) CreateIndex(indexName string, keys []string, opts *CreateQueryIndexOptions) error

CreateIndex creates an index over the specified fields. The SDK will automatically escape the provided index keys. For more advanced use cases like index keys using keywords scope.Query should be used with the query directly.

func (*CollectionQueryIndexManager) CreatePrimaryIndex added in v2.6.1

CreatePrimaryIndex creates a primary index. An empty customName uses the default naming.

func (*CollectionQueryIndexManager) DropIndex added in v2.6.1

func (qm *CollectionQueryIndexManager) DropIndex(indexName string, opts *DropQueryIndexOptions) error

DropIndex drops a specific index by name.

func (*CollectionQueryIndexManager) DropPrimaryIndex added in v2.6.1

DropPrimaryIndex drops the primary index. Pass an empty customName for unnamed primary indexes.

func (*CollectionQueryIndexManager) GetAllIndexes added in v2.6.1

GetAllIndexes returns a list of all currently registered indexes.

func (*CollectionQueryIndexManager) WatchIndexes added in v2.6.1

func (qm *CollectionQueryIndexManager) WatchIndexes(watchList []string, timeout time.Duration, opts *WatchQueryIndexOptions) error

WatchIndexes waits for a set of indexes to come online.

type CollectionSpec

type CollectionSpec struct {
	Name      string
	ScopeName string
	MaxExpiry time.Duration
}

CollectionSpec describes the specification of a collection.

type CompressionConfig added in v2.5.0

type CompressionConfig struct {
	Disabled bool

	// MinSize specifies the minimum size of the document to consider compression.
	MinSize uint32
	// MinRatio specifies the minimal compress ratio (compressed / original) for the document to be sent compressed.
	MinRatio float64
}

CompressionConfig specifies options for controlling compression applied to documents before sending to Couchbase Server.

type CompressionMode

type CompressionMode string

CompressionMode specifies the kind of compression to use for a bucket.

const (
	// CompressionModeOff specifies to use no compression for a bucket.
	CompressionModeOff CompressionMode = "off"

	// CompressionModePassive specifies to use passive compression for a bucket.
	CompressionModePassive CompressionMode = "passive"

	// CompressionModeActive specifies to use active compression for a bucket.
	CompressionModeActive CompressionMode = "active"
)

type ConflictResolutionType

type ConflictResolutionType string

ConflictResolutionType specifies the kind of conflict resolution to use for a bucket.

const (
	// ConflictResolutionTypeTimestamp specifies to use timestamp conflict resolution on the bucket.
	ConflictResolutionTypeTimestamp ConflictResolutionType = "lww"

	// ConflictResolutionTypeSequenceNumber specifies to use sequence number conflict resolution on the bucket.
	ConflictResolutionTypeSequenceNumber ConflictResolutionType = "seqno"

	// ConflictResolutionTypeCustom specifies to use a custom bucket conflict resolution.
	// In Couchbase Server 7.1, this feature is only available in "developer-preview" mode. See the UI XDCR settings
	// for the custom conflict resolution properties.
	// VOLATILE: This API is subject to change at any time.
	ConflictResolutionTypeCustom ConflictResolutionType = "custom"
)

type ConnectAnalyticsLinkOptions

type ConnectAnalyticsLinkOptions struct {
	LinkName      string
	DataverseName string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

ConnectAnalyticsLinkOptions is the set of options available to the AnalyticsManager ConnectLink operation.

type CouchbaseList

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

CouchbaseList represents a list document.

func (*CouchbaseList) Append

func (cl *CouchbaseList) Append(val interface{}) error

Append appends an item to the list.

func (*CouchbaseList) At

func (cl *CouchbaseList) At(index int, valuePtr interface{}) error

At retrieves the value specified at the given index from the list.

func (*CouchbaseList) Clear

func (cl *CouchbaseList) Clear() error

Clear clears a list, also removing it.

func (*CouchbaseList) IndexOf

func (cl *CouchbaseList) IndexOf(val interface{}) (int, error)

IndexOf gets the index of the item in the list.

func (*CouchbaseList) Iterator

func (cl *CouchbaseList) Iterator() ([]interface{}, error)

Iterator returns an iterable for all items in the list.

func (*CouchbaseList) Prepend

func (cl *CouchbaseList) Prepend(val interface{}) error

Prepend prepends an item to the list.

func (*CouchbaseList) RemoveAt

func (cl *CouchbaseList) RemoveAt(index int) error

RemoveAt removes the value specified at the given index from the list.

func (*CouchbaseList) Size

func (cl *CouchbaseList) Size() (int, error)

Size returns the size of the list.

type CouchbaseMap

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

CouchbaseMap represents a map document.

func (*CouchbaseMap) Add

func (cl *CouchbaseMap) Add(id string, val interface{}) error

Add adds an item to the map.

func (*CouchbaseMap) At

func (cl *CouchbaseMap) At(id string, valuePtr interface{}) error

At retrieves the item for the given id from the map.

func (*CouchbaseMap) Clear

func (cl *CouchbaseMap) Clear() error

Clear clears a map, also removing it.

func (*CouchbaseMap) Exists

func (cl *CouchbaseMap) Exists(id string) (bool, error)

Exists verifies whether or a id exists in the map.

func (*CouchbaseMap) Iterator

func (cl *CouchbaseMap) Iterator() (map[string]interface{}, error)

Iterator returns an iterable for all items in the map.

func (*CouchbaseMap) Keys

func (cl *CouchbaseMap) Keys() ([]string, error)

Keys returns all of the keys within the map.

func (*CouchbaseMap) Remove

func (cl *CouchbaseMap) Remove(id string) error

Remove removes an item from the map.

func (*CouchbaseMap) Size

func (cl *CouchbaseMap) Size() (int, error)

Size returns the size of the map.

func (*CouchbaseMap) Values

func (cl *CouchbaseMap) Values() ([]interface{}, error)

Values returns all of the values within the map.

type CouchbaseQueue

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

CouchbaseQueue represents a queue document.

func (*CouchbaseQueue) Clear

func (cs *CouchbaseQueue) Clear() error

Clear clears a queue, also removing it.

func (*CouchbaseQueue) Iterator

func (cs *CouchbaseQueue) Iterator() ([]interface{}, error)

Iterator returns an iterable for all items in the queue.

func (*CouchbaseQueue) Pop

func (cs *CouchbaseQueue) Pop(valuePtr interface{}) error

Pop pops an items off of the queue.

func (*CouchbaseQueue) Push

func (cs *CouchbaseQueue) Push(val interface{}) error

Push pushes a value onto the queue.

func (*CouchbaseQueue) Size

func (cs *CouchbaseQueue) Size() (int, error)

Size returns the size of the queue.

type CouchbaseRemoteAnalyticsEncryptionSettings added in v2.3.0

type CouchbaseRemoteAnalyticsEncryptionSettings struct {
	// The level of encryption to apply, defaults to none
	EncryptionLevel AnalyticsEncryptionLevel
	// The certificate to use when encryption level is set to full.
	// This must be set if encryption level is set to full.
	Certificate []byte
	// The client certificate to use when encryption level is set to full.
	// This cannot be used if username and password are also used.
	ClientCertificate []byte
	// The client key to use when encryption level is set to full.
	// This cannot be used if username and password are also used.
	ClientKey []byte
}

CouchbaseRemoteAnalyticsEncryptionSettings are the settings available for setting encryption level on a link.

type CouchbaseRemoteAnalyticsLink struct {
	Dataverse  string
	LinkName   string
	Hostname   string
	Encryption CouchbaseRemoteAnalyticsEncryptionSettings
	Username   string
	Password   string
}

CouchbaseRemoteAnalyticsLink describes a remote analytics link which uses a Couchbase data service that is not part of the same cluster as the Analytics Service.

func NewCouchbaseRemoteAnalyticsLink(linkName, hostname, dataverseName string,
	opts *NewCouchbaseRemoteAnalyticsLinkOptions) *CouchbaseRemoteAnalyticsLink

NewCouchbaseRemoteAnalyticsLink creates a new CouchbaseRemoteAnalyticsLink. Scope is the analytics scope in the form of "bucket/scope".

func (*CouchbaseRemoteAnalyticsLink) DataverseName added in v2.3.0

func (al *CouchbaseRemoteAnalyticsLink) DataverseName() string

DataverseName returns the name of the dataverse that this link belongs to.

func (*CouchbaseRemoteAnalyticsLink) FormEncode added in v2.3.0

func (al *CouchbaseRemoteAnalyticsLink) FormEncode() ([]byte, error)

FormEncode encodes the link into a form data representation, to sent as the body of a CreateLink or ReplaceLink request.

func (*CouchbaseRemoteAnalyticsLink) LinkType added in v2.3.0

LinkType returns the type of analytics type this link is: AnalyticsLinkTypeCouchbaseRemote.

func (*CouchbaseRemoteAnalyticsLink) Name added in v2.3.0

Name returns the name of this link.

func (*CouchbaseRemoteAnalyticsLink) Validate added in v2.3.0

func (al *CouchbaseRemoteAnalyticsLink) Validate() error

Validate is used by CreateLink and ReplaceLink to ensure that the link is valid.

type CouchbaseSet

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

CouchbaseSet represents a set document.

func (*CouchbaseSet) Add

func (cs *CouchbaseSet) Add(val interface{}) error

Add adds a value to the set.

func (*CouchbaseSet) Clear

func (cs *CouchbaseSet) Clear() error

Clear clears a set, also removing it.

func (*CouchbaseSet) Contains

func (cs *CouchbaseSet) Contains(val string) (bool, error)

Contains verifies whether or not a value exists within the set.

func (*CouchbaseSet) Iterator

func (cs *CouchbaseSet) Iterator() ([]interface{}, error)

Iterator returns an iterable for all items in the set.

func (*CouchbaseSet) Remove

func (cs *CouchbaseSet) Remove(val string) error

Remove removes an value from the set.

func (*CouchbaseSet) Size

func (cs *CouchbaseSet) Size() (int, error)

Size returns the size of the set

func (*CouchbaseSet) Values

func (cs *CouchbaseSet) Values() ([]interface{}, error)

Values returns all of the values within the set.

type CountSpecOptions

type CountSpecOptions struct {
	IsXattr bool
}

CountSpecOptions are the options available to LookupIn subdoc Count operations.

type Counter added in v2.3.0

type Counter interface {
	IncrementBy(num uint64)
}

Counter is used for incrementing a synchronous count metric.

type CounterResult

type CounterResult struct {
	MutationResult
	// contains filtered or unexported fields
}

CounterResult is the return type of counter operations.

func (CounterResult) Cas

func (mr CounterResult) Cas() Cas

Cas returns the Cas value for a document following an operation.

func (CounterResult) Content

func (mr CounterResult) Content() uint64

Content returns the new value for the counter document.

func (CounterResult) MutationToken

func (mr CounterResult) MutationToken() *MutationToken

MutationToken returns the mutation token belonging to an operation.

type CounterSpecOptions

type CounterSpecOptions struct {
	CreatePath bool
	IsXattr    bool
}

CounterSpecOptions are the options available to subdocument Increment and Decrement operations.

type CreateAnalyticsDatasetOptions

type CreateAnalyticsDatasetOptions struct {
	IgnoreIfExists bool
	Condition      string
	DataverseName  string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateAnalyticsDatasetOptions is the set of options available to the AnalyticsManager CreateDataset operation.

type CreateAnalyticsDataverseOptions

type CreateAnalyticsDataverseOptions struct {
	IgnoreIfExists bool

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateAnalyticsDataverseOptions is the set of options available to the AnalyticsManager CreateDataverse operation.

type CreateAnalyticsIndexOptions

type CreateAnalyticsIndexOptions struct {
	IgnoreIfExists bool
	DataverseName  string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateAnalyticsIndexOptions is the set of options available to the AnalyticsManager CreateIndex operation.

type CreateAnalyticsLinkOptions added in v2.3.0

type CreateAnalyticsLinkOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateAnalyticsLinkOptions is the set of options available to the analytics manager CreateLink function.

type CreateBucketOptions

type CreateBucketOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateBucketOptions is the set of options available to the bucket manager CreateBucket operation.

type CreateBucketSettings

type CreateBucketSettings struct {
	BucketSettings
	ConflictResolutionType ConflictResolutionType
}

CreateBucketSettings are the settings available when creating a bucket.

type CreateCollectionOptions

type CreateCollectionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateCollectionOptions is the set of options available to the CreateCollection operation.

type CreatePrimaryQueryIndexOptions

type CreatePrimaryQueryIndexOptions struct {
	IgnoreIfExists bool
	Deferred       bool
	CustomName     string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreatePrimaryQueryIndexOptions is the set of options available to the query indexes CreatePrimaryIndex operation.

type CreateQueryIndexOptions

type CreateQueryIndexOptions struct {
	IgnoreIfExists bool
	Deferred       bool

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateQueryIndexOptions is the set of options available to the query indexes CreateIndex operation.

type CreateScopeOptions

type CreateScopeOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

CreateScopeOptions is the set of options available to the CreateScope operation.

type DecrementOp

type DecrementOp struct {
	ID      string
	Delta   int64
	Initial int64
	Expiry  time.Duration

	Result *CounterResult
	Err    error
	// contains filtered or unexported fields
}

DecrementOp represents a type of `BulkOp` used for Decrement operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type DecrementOptions

type DecrementOptions struct {
	Timeout time.Duration
	// Expiry is the length of time that the document will be stored in Couchbase.
	// A value of 0 will set the document to never expire.
	Expiry time.Duration
	// Initial, if non-negative, is the `initial` value to use for the document if it does not exist.
	// If present, this is the value that will be returned by a successful operation.
	Initial int64
	// Delta is the value to use for incrementing/decrementing if Initial is not present.
	Delta           uint64
	DurabilityLevel DurabilityLevel
	PersistTo       uint
	ReplicateTo     uint
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan

	// Deprecated: Cas is not supported by the server for Decrement, and is no longer used.
	Cas Cas

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

DecrementOptions are the options available to the Decrement operation.

type DeployEventingFunctionOptions added in v2.3.2

type DeployEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DeployEventingFunctionOptions are the options available when using the DeployFunction operation.

type DesignDocument

type DesignDocument struct {
	Name  string
	Views map[string]View
}

DesignDocument represents a Couchbase design document containing multiple views.

type DesignDocumentNamespace

type DesignDocumentNamespace uint

DesignDocumentNamespace represents which namespace a design document resides in.

const (
	// DesignDocumentNamespaceProduction means that a design document resides in the production namespace.
	DesignDocumentNamespaceProduction DesignDocumentNamespace = iota

	// DesignDocumentNamespaceDevelopment means that a design document resides in the development namespace.
	DesignDocumentNamespaceDevelopment
)

type DiagnosticsOptions

type DiagnosticsOptions struct {
	ReportID string
}

DiagnosticsOptions are the options that are available for use with the Diagnostics operation.

type DiagnosticsResult

type DiagnosticsResult struct {
	ID       string
	Services map[string][]EndPointDiagnostics

	State ClusterState
	// contains filtered or unexported fields
}

DiagnosticsResult encapsulates the results of a Diagnostics operation.

func (*DiagnosticsResult) MarshalJSON

func (report *DiagnosticsResult) MarshalJSON() ([]byte, error)

MarshalJSON generates a JSON representation of this diagnostics report.

type DisallowQueryingSearchIndexOptions

type DisallowQueryingSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DisallowQueryingSearchIndexOptions is the set of options available to the search index DisallowQuerying operation.

type DisconnectAnalyticsLinkOptions

type DisconnectAnalyticsLinkOptions struct {
	LinkName      string
	DataverseName string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DisconnectAnalyticsLinkOptions is the set of options available to the AnalyticsManager DisconnectLink operation.

type DropAnalyticsDatasetOptions

type DropAnalyticsDatasetOptions struct {
	IgnoreIfNotExists bool
	DataverseName     string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropAnalyticsDatasetOptions is the set of options available to the AnalyticsManager DropDataset operation.

type DropAnalyticsDataverseOptions

type DropAnalyticsDataverseOptions struct {
	IgnoreIfNotExists bool

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropAnalyticsDataverseOptions is the set of options available to the AnalyticsManager DropDataverse operation.

type DropAnalyticsIndexOptions

type DropAnalyticsIndexOptions struct {
	IgnoreIfNotExists bool
	DataverseName     string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropAnalyticsIndexOptions is the set of options available to the AnalyticsManager DropIndex operation.

type DropAnalyticsLinkOptions added in v2.3.0

type DropAnalyticsLinkOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropAnalyticsLinkOptions is the set of options available to the analytics manager DropLink function.

type DropBucketOptions

type DropBucketOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropBucketOptions is the set of options available to the bucket manager DropBucket operation.

type DropCollectionOptions

type DropCollectionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropCollectionOptions is the set of options available to the DropCollection operation.

type DropDesignDocumentOptions

type DropDesignDocumentOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropDesignDocumentOptions is the set of options available to the ViewIndexManager Upsert operation.

type DropEventingFunctionOptions added in v2.3.2

type DropEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropEventingFunctionOptions are the options available when using the DropFunction operation.

type DropGroupOptions

type DropGroupOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropGroupOptions is the set of options available to the group manager Drop operation.

type DropPrimaryQueryIndexOptions

type DropPrimaryQueryIndexOptions struct {
	IgnoreIfNotExists bool
	CustomName        string

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropPrimaryQueryIndexOptions is the set of options available to the query indexes DropPrimaryIndex operation.

type DropQueryIndexOptions

type DropQueryIndexOptions struct {
	IgnoreIfNotExists bool

	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropQueryIndexOptions is the set of options available to the query indexes DropIndex operation.

type DropScopeOptions

type DropScopeOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropScopeOptions is the set of options available to the DropScope operation.

type DropSearchIndexOptions

type DropSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropSearchIndexOptions is the set of options available to the search index DropIndex operation.

type DropUserOptions

type DropUserOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy

	DomainName string
	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

DropUserOptions is the set of options available to the user manager Drop operation.

type DurabilityLevel

type DurabilityLevel uint8

DurabilityLevel specifies the level of synchronous replication to use.

const (
	// DurabilityLevelUnknown specifies that the durability level is not set and will default to the default durability level.
	DurabilityLevelUnknown DurabilityLevel = iota

	// DurabilityLevelNone specifies that no durability level should be applied.
	DurabilityLevelNone

	// DurabilityLevelMajority specifies that a mutation must be replicated (held in memory) to a majority of nodes.
	DurabilityLevelMajority

	// DurabilityLevelMajorityAndPersistOnMaster specifies that a mutation must be replicated (held in memory) to a
	// majority of nodes and also persisted (written to disk) on the active node.
	DurabilityLevelMajorityAndPersistOnMaster

	// DurabilityLevelPersistToMajority specifies that a mutation must be persisted (written to disk) to a majority
	// of nodes.
	DurabilityLevelPersistToMajority
)

type EndPointDiagnostics

type EndPointDiagnostics struct {
	Type         ServiceType
	ID           string
	Local        string
	Remote       string
	LastActivity time.Time
	State        EndpointState
	Namespace    string
}

EndPointDiagnostics represents a single entry in a diagnostics report.

type EndpointPingReport

type EndpointPingReport struct {
	ID        string
	Local     string
	Remote    string
	State     PingState
	Error     string
	Namespace string
	Latency   time.Duration
}

EndpointPingReport represents a single entry in a ping report.

type EndpointState

type EndpointState uint

EndpointState specifies the current state of an endpoint.

const (
	// EndpointStateDisconnected indicates the endpoint socket is unreachable.
	EndpointStateDisconnected EndpointState = iota + 1

	// EndpointStateConnecting indicates the endpoint socket is connecting.
	EndpointStateConnecting

	// EndpointStateConnected indicates the endpoint socket is connected and ready.
	EndpointStateConnected

	// EndpointStateDisconnecting indicates the endpoint socket is disconnecting.
	EndpointStateDisconnecting
)

type EventingFunction added in v2.3.2

type EventingFunction struct {
	Name               string // Required
	Code               string // Required
	Version            string
	EnforceSchema      bool
	HandlerUUID        int
	FunctionInstanceID string
	MetadataKeyspace   EventingFunctionKeyspace // Required
	SourceKeyspace     EventingFunctionKeyspace // Required
	BucketBindings     []EventingFunctionBucketBinding
	UrlBindings        []EventingFunctionUrlBinding
	ConstantBindings   []EventingFunctionConstantBinding
	Settings           EventingFunctionSettings
}

EventingFunction represents an eventing function.

func (EventingFunction) MarshalJSON added in v2.3.2

func (ef EventingFunction) MarshalJSON() ([]byte, error)

func (*EventingFunction) UnmarshalJSON added in v2.3.2

func (ef *EventingFunction) UnmarshalJSON(b []byte) error

type EventingFunctionBucketAccess added in v2.3.2

type EventingFunctionBucketAccess string

EventingFunctionBucketAccess represents the level of access an eventing function has to a bucket.

var (
	// EventingFunctionBucketAccessReadOnly represents readonly access to a bucket for an eventing function.
	EventingFunctionBucketAccessReadOnly EventingFunctionBucketAccess = "r"

	// EventingFunctionBucketAccessReadWrite represents readwrite access to a bucket for an eventing function.
	EventingFunctionBucketAccessReadWrite EventingFunctionBucketAccess = "rw"
)

type EventingFunctionBucketBinding added in v2.3.2

type EventingFunctionBucketBinding struct {
	Alias  string
	Name   EventingFunctionKeyspace
	Access EventingFunctionBucketAccess
}

EventingFunctionBucketBinding represents an eventing function binding allowing the function access to buckets, scopes, and collections.

type EventingFunctionConstantBinding added in v2.3.2

type EventingFunctionConstantBinding struct {
	Alias   string
	Literal string
}

EventingFunctionConstantBinding represents an eventing function binding allowing the function to utilize global variables.

type EventingFunctionDCPBoundary added in v2.3.2

type EventingFunctionDCPBoundary string

EventingFunctionDCPBoundary sets what data mutations to deploy the eventing function for.

var (
	// EventingFunctionDCPBoundaryEverything will deploy the eventing function for all data mutations.
	EventingFunctionDCPBoundaryEverything EventingFunctionDCPBoundary = "everything"

	// EventingFunctionDCPBoundaryFromNow will deploy the eventing function for only data mutations occurring post deployment.
	EventingFunctionDCPBoundaryFromNow EventingFunctionDCPBoundary = "from_now"
)

type EventingFunctionDeploymentStatus added in v2.3.2

type EventingFunctionDeploymentStatus bool

EventingFunctionDeploymentStatus represents the current deployment status for the eventing function.

var (
	// EventingFunctionDeploymentStatusDeployed represents that the eventing function is currently deployed.
	EventingFunctionDeploymentStatusDeployed EventingFunctionDeploymentStatus = true

	// EventingFunctionDeploymentStatusUndeployed represents that the eventing function is currently undeployed.
	EventingFunctionDeploymentStatusUndeployed EventingFunctionDeploymentStatus = false
)

type EventingFunctionKeyspace added in v2.3.2

type EventingFunctionKeyspace struct {
	Bucket     string
	Scope      string
	Collection string
}

EventingFunctionKeyspace represents a triple of bucket, collection, and scope names.

type EventingFunctionLanguageCompatibility added in v2.3.2

type EventingFunctionLanguageCompatibility string

EventingFunctionLanguageCompatibility represents the eventing function language compatibility for backward compatibility.

var (
	// EventingFunctionLanguageCompatibilityVersion600 represents the eventing function language compatibility 6.0.0.
	EventingFunctionLanguageCompatibilityVersion600 EventingFunctionLanguageCompatibility = "6.0.0"

	// EventingFunctionLanguageCompatibilityVersion650 represents the eventing function language compatibility 6.5.0.
	EventingFunctionLanguageCompatibilityVersion650 EventingFunctionLanguageCompatibility = "6.5.0"

	// EventingFunctionLanguageCompatibilityVersion662 represents the eventing function language compatibility 6.6.2.
	EventingFunctionLanguageCompatibilityVersion662 EventingFunctionLanguageCompatibility = "6.6.2"
)

type EventingFunctionLogLevel added in v2.3.2

type EventingFunctionLogLevel string

EventingFunctionLogLevel represents the granularity at which to log messages for the eventing function.

var (
	// EventingFunctionLogLevelInfo represents to log messages at INFO for the eventing function.
	EventingFunctionLogLevelInfo EventingFunctionLogLevel = "INFO"

	// EventingFunctionLogLevelError represents to log messages at ERROR for the eventing function.
	EventingFunctionLogLevelError EventingFunctionLogLevel = "ERROR"

	// EventingFunctionLogLevelWarning represents to log messages at WARNING for the eventing function.
	EventingFunctionLogLevelWarning EventingFunctionLogLevel = "WARNING"

	// EventingFunctionLogLevelDebug represents to log messages at DEBUG for the eventing function.
	EventingFunctionLogLevelDebug EventingFunctionLogLevel = "DEBUG"

	// EventingFunctionLogLevelTrace represents to log messages at TRACE for the eventing function.
	EventingFunctionLogLevelTrace EventingFunctionLogLevel = "TRACE"
)

type EventingFunctionManager added in v2.3.2

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

EventingFunctionManager provides methods for performing eventing function management operations. This manager is designed to work only against Couchbase Server 7.0+, it might work against earlier server versions but that is not tested and is not supported. UNCOMMITTED: This API may change in the future.

func (*EventingFunctionManager) DeployFunction added in v2.3.2

func (efm *EventingFunctionManager) DeployFunction(name string, opts *DeployEventingFunctionOptions) error

DeployFunction deploys an eventing function.

func (*EventingFunctionManager) DropFunction added in v2.3.2

func (efm *EventingFunctionManager) DropFunction(name string, opts *DropEventingFunctionOptions) error

DropFunction drops an eventing function.

func (*EventingFunctionManager) FunctionsStatus added in v2.3.2

FunctionsStatus fetches the current status of all eventing functions.

func (*EventingFunctionManager) GetAllFunctions added in v2.3.2

GetAllFunctions fetches all of the eventing functions.

func (*EventingFunctionManager) GetFunction added in v2.3.2

GetFunction fetches an eventing function.

func (*EventingFunctionManager) PauseFunction added in v2.3.2

func (efm *EventingFunctionManager) PauseFunction(name string, opts *PauseEventingFunctionOptions) error

PauseFunction pauses an eventing function.

func (*EventingFunctionManager) ResumeFunction added in v2.3.2

func (efm *EventingFunctionManager) ResumeFunction(name string, opts *ResumeEventingFunctionOptions) error

ResumeFunction resumes an eventing function.

func (*EventingFunctionManager) UndeployFunction added in v2.3.2

func (efm *EventingFunctionManager) UndeployFunction(name string, opts *UndeployEventingFunctionOptions) error

UndeployFunction undeploys an eventing function.

func (*EventingFunctionManager) UpsertFunction added in v2.3.2

func (efm *EventingFunctionManager) UpsertFunction(function EventingFunction, opts *UpsertEventingFunctionOptions) error

UpsertFunction inserts or updates an eventing function.

type EventingFunctionProcessingStatus added in v2.3.2

type EventingFunctionProcessingStatus bool

EventingFunctionProcessingStatus represents the current processing status for the eventing function.

var (
	// EventingFunctionProcessingStatusRunning represents that the eventing function is currently running.
	EventingFunctionProcessingStatusRunning EventingFunctionProcessingStatus = true

	// EventingFunctionProcessingStatusPaused represents that the eventing function is currently paused.
	EventingFunctionProcessingStatusPaused EventingFunctionProcessingStatus = false
)

type EventingFunctionSettings added in v2.3.2

type EventingFunctionSettings struct {
	CPPWorkerThreadCount   int
	DCPStreamBoundary      EventingFunctionDCPBoundary
	Description            string
	DeploymentStatus       EventingFunctionDeploymentStatus
	ProcessingStatus       EventingFunctionProcessingStatus
	LanguageCompatibility  EventingFunctionLanguageCompatibility
	LogLevel               EventingFunctionLogLevel
	ExecutionTimeout       time.Duration
	LCBInstCapacity        int
	LCBRetryCount          int
	LCBTimeout             time.Duration
	QueryConsistency       QueryScanConsistency
	NumTimerPartitions     int
	SockBatchSize          int
	TickDuration           time.Duration
	TimerContextSize       int
	UserPrefix             string
	BucketCacheSize        int
	BucketCacheAge         int
	CurlMaxAllowedRespSize int
	QueryPrepareAll        bool
	WorkerCount            int
	HandlerHeaders         []string
	HandlerFooters         []string
	EnableAppLogRotation   bool
	AppLogDir              string
	AppLogMaxSize          int
	AppLogMaxFiles         int
	CheckpointInterval     time.Duration
}

EventingFunctionSettings are the settings for an EventingFunction.

type EventingFunctionState added in v2.3.2

type EventingFunctionState struct {
	Name                  string
	Status                EventingFunctionStatus
	NumBootstrappingNodes int
	NumDeployedNodes      int
	DeploymentStatus      EventingFunctionDeploymentStatus
	ProcessingStatus      EventingFunctionProcessingStatus
}

EventingFunctionState represents the current state of an eventing function.

type EventingFunctionStatus added in v2.3.2

type EventingFunctionStatus string

EventingFunctionStatus describes the current state of an eventing function.

var (
	// EventingFunctionStateUndeployed represents that the eventing function is undeployed.
	EventingFunctionStateUndeployed EventingFunctionStatus = "undeployed"

	// EventingFunctionStateDeploying represents that the eventing function is deploying.
	EventingFunctionStateDeploying EventingFunctionStatus = "deploying"

	// EventingFunctionStateDeployed represents that the eventing function is deployed.
	EventingFunctionStateDeployed EventingFunctionStatus = "deployed"

	// EventingFunctionStateUndeploying represents that the eventing function is undeploying.
	EventingFunctionStateUndeploying EventingFunctionStatus = "undeploying"

	// EventingFunctionStatePaused represents that the eventing function is paused.
	EventingFunctionStatePaused EventingFunctionStatus = "paused"

	// EventingFunctionStatePausing represents that the eventing function is pausing.
	EventingFunctionStatePausing EventingFunctionStatus = "pausing"
)

type EventingFunctionUrlAuth added in v2.3.2

type EventingFunctionUrlAuth interface {
	Method() string
	Username() string
	Password() string
	Key() string
}

EventingFunctionUrlAuth represents an authentication method for EventingFunctionUrlBinding for an eventing function.

type EventingFunctionUrlAuthBasic added in v2.3.2

type EventingFunctionUrlAuthBasic struct {
	User string
	Pass string
}

EventingFunctionUrlAuthBasic specifies that basic authentication is used for the EventingFunctionUrlBinding.

func (EventingFunctionUrlAuthBasic) Key added in v2.3.2

func (EventingFunctionUrlAuthBasic) Method added in v2.3.2

func (EventingFunctionUrlAuthBasic) Password added in v2.3.2

func (ua EventingFunctionUrlAuthBasic) Password() string

func (EventingFunctionUrlAuthBasic) Username added in v2.3.2

func (ua EventingFunctionUrlAuthBasic) Username() string

type EventingFunctionUrlAuthBearer added in v2.3.2

type EventingFunctionUrlAuthBearer struct {
	BearerKey string
}

EventingFunctionUrlAuthBearer specifies that bearer token authentication is used for the EventingFunctionUrlBinding.

func (EventingFunctionUrlAuthBearer) Key added in v2.3.2

func (EventingFunctionUrlAuthBearer) Method added in v2.3.2

func (EventingFunctionUrlAuthBearer) Password added in v2.3.2

func (ua EventingFunctionUrlAuthBearer) Password() string

func (EventingFunctionUrlAuthBearer) Username added in v2.3.2

func (ua EventingFunctionUrlAuthBearer) Username() string

type EventingFunctionUrlAuthDigest added in v2.3.2

type EventingFunctionUrlAuthDigest struct {
	User string
	Pass string
}

EventingFunctionUrlAuthDigest specifies that digest authentication is used for the EventingFunctionUrlBinding.

func (EventingFunctionUrlAuthDigest) Key added in v2.3.2

func (EventingFunctionUrlAuthDigest) Method added in v2.3.2

func (EventingFunctionUrlAuthDigest) Password added in v2.3.2

func (ua EventingFunctionUrlAuthDigest) Password() string

func (EventingFunctionUrlAuthDigest) Username added in v2.3.2

func (ua EventingFunctionUrlAuthDigest) Username() string

type EventingFunctionUrlBinding added in v2.3.2

type EventingFunctionUrlBinding struct {
	Hostname               string
	Alias                  string
	Auth                   EventingFunctionUrlAuth
	AllowCookies           bool
	ValidateSSLCertificate bool
}

EventingFunctionUrlBinding represents an eventing function binding allowing the function access external resources via cURL.

type EventingFunctionUrlNoAuth added in v2.3.2

type EventingFunctionUrlNoAuth struct{}

EventingFunctionUrlNoAuth specifies that no authentication is used for the EventingFunctionUrlBinding.

func (EventingFunctionUrlNoAuth) Key added in v2.3.2

func (EventingFunctionUrlNoAuth) Method added in v2.3.2

func (ua EventingFunctionUrlNoAuth) Method() string

func (EventingFunctionUrlNoAuth) Password added in v2.3.2

func (ua EventingFunctionUrlNoAuth) Password() string

func (EventingFunctionUrlNoAuth) Username added in v2.3.2

func (ua EventingFunctionUrlNoAuth) Username() string

type EventingFunctionsStatusOptions added in v2.3.2

type EventingFunctionsStatusOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

EventingFunctionsStatusOptions are the options available when using the FunctionsStatus operation.

type EventingStatus added in v2.3.2

type EventingStatus struct {
	NumEventingNodes int
	Functions        []EventingFunctionState
}

EventingStatus represents the current state of all eventing functions.

func (*EventingStatus) UnmarshalJSON added in v2.3.2

func (ef *EventingStatus) UnmarshalJSON(b []byte) error

type EvictionPolicyType

type EvictionPolicyType string

EvictionPolicyType specifies the kind of eviction policy to use for a bucket.

const (
	// EvictionPolicyTypeFull specifies to use full eviction for a couchbase bucket.
	EvictionPolicyTypeFull EvictionPolicyType = "fullEviction"

	// EvictionPolicyTypeValueOnly specifies to use value only eviction for a couchbase bucket.
	EvictionPolicyTypeValueOnly EvictionPolicyType = "valueOnly"

	// EvictionPolicyTypeNotRecentlyUsed specifies to use not recently used (nru) eviction for an ephemeral bucket.
	EvictionPolicyTypeNotRecentlyUsed EvictionPolicyType = "nruEviction"

	// EvictionPolicyTypeNRU specifies to use no eviction for an ephemeral bucket.
	EvictionPolicyTypeNoEviction EvictionPolicyType = "noEviction"
)

type ExistsOptions

type ExistsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

ExistsOptions are the options available to the Exists command.

type ExistsResult

type ExistsResult struct {
	Result
	// contains filtered or unexported fields
}

ExistsResult is the return type of Exist operations.

func (*ExistsResult) Exists

func (d *ExistsResult) Exists() bool

Exists returns whether or not the document exists.

type ExistsSpecOptions

type ExistsSpecOptions struct {
	IsXattr bool
}

ExistsSpecOptions are the options available to LookupIn subdoc Exists operations.

type FlushBucketOptions

type FlushBucketOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

FlushBucketOptions is the set of options available to the bucket manager FlushBucket operation.

type FreezePlanSearchIndexOptions

type FreezePlanSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

FreezePlanSearchIndexOptions is the set of options available to the search index FreezePlan operation.

type GetAllAnalyticsDatasetsOptions

type GetAllAnalyticsDatasetsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllAnalyticsDatasetsOptions is the set of options available to the AnalyticsManager GetAllDatasets operation.

type GetAllAnalyticsIndexesOptions

type GetAllAnalyticsIndexesOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllAnalyticsIndexesOptions is the set of options available to the AnalyticsManager GetAllIndexes operation.

type GetAllBucketsOptions

type GetAllBucketsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllBucketsOptions is the set of options available to the bucket manager GetAll operation.

type GetAllDesignDocumentsOptions

type GetAllDesignDocumentsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllDesignDocumentsOptions is the set of options available to the ViewIndexManager GetAllDesignDocuments operation.

type GetAllEventingFunctionsOptions added in v2.3.2

type GetAllEventingFunctionsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllEventingFunctionsOptions are the options available when using the GetAllFunctions operation.

type GetAllGroupsOptions

type GetAllGroupsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllGroupsOptions is the set of options available to the group manager GetAll operation.

type GetAllQueryIndexesOptions

type GetAllQueryIndexesOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllQueryIndexesOptions is the set of options available to the query indexes GetAllIndexes operation.

type GetAllReplicaOptions

type GetAllReplicaOptions struct {
	Transcoder    Transcoder
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
	// contains filtered or unexported fields
}

GetAllReplicaOptions are the options available to the GetAllReplicas command.

type GetAllReplicasResult

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

GetAllReplicasResult represents the results of a GetAllReplicas operation.

func (*GetAllReplicasResult) Close

func (r *GetAllReplicasResult) Close() error

Close cancels all remaining get replica requests.

func (*GetAllReplicasResult) Next

Next fetches the next replica result.

type GetAllScopesOptions

type GetAllScopesOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllScopesOptions is the set of options available to the GetAllScopes operation.

type GetAllSearchIndexOptions

type GetAllSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllSearchIndexOptions is the set of options available to the search indexes GetAllIndexes operation.

type GetAllUsersOptions

type GetAllUsersOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy

	DomainName string
	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAllUsersOptions is the set of options available to the user manager GetAll operation.

type GetAnalyticsLinksOptions added in v2.3.0

type GetAnalyticsLinksOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Dataverse restricts the results to a given dataverse, can be given in the form of "namepart" or "namepart1/namepart2".
	Dataverse string
	// LinkType restricts the results to the given link type.
	LinkType AnalyticsLinkType
	// Name restricts the results to the link with the specified name.
	// If set then `Scope` must also be set.
	Name string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetAnalyticsLinksOptions are the options available to the AnalyticsManager GetLinks function.

type GetAndLockOptions

type GetAndLockOptions struct {
	Transcoder    Transcoder
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

GetAndLockOptions are the options available to the GetAndLock operation.

type GetAndTouchOp

type GetAndTouchOp struct {
	ID     string
	Expiry time.Duration
	Result *GetResult
	Err    error
	// contains filtered or unexported fields
}

GetAndTouchOp represents a type of `BulkOp` used for GetAndTouch operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type GetAndTouchOptions

type GetAndTouchOptions struct {
	Transcoder    Transcoder
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

GetAndTouchOptions are the options available to the GetAndTouch operation.

type GetAnyReplicaOptions

type GetAnyReplicaOptions struct {
	Transcoder    Transcoder
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

GetAnyReplicaOptions are the options available to the GetAnyReplica command.

type GetBucketOptions

type GetBucketOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetBucketOptions is the set of options available to the bucket manager GetBucket operation.

type GetDesignDocumentOptions

type GetDesignDocumentOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetDesignDocumentOptions is the set of options available to the ViewIndexManager GetDesignDocument operation.

type GetEventingFunctionOptions added in v2.3.2

type GetEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetEventingFunctionOptions are the options available when using the GetFunction operation.

type GetGroupOptions

type GetGroupOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetGroupOptions is the set of options available to the group manager Get operation.

type GetIndexedDocumentsCountOptions

type GetIndexedDocumentsCountOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetIndexedDocumentsCountOptions is the set of options available to the search index GetIndexedDocumentsCount operation.

type GetNodesMetadataOptions added in v2.4.1

type GetNodesMetadataOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetNodesMetadataOptions is the set of options available to the GetNodesMetadata operation. Internal: This should never be used and is not supported.

type GetOp

type GetOp struct {
	ID     string
	Result *GetResult
	Err    error
	// contains filtered or unexported fields
}

GetOp represents a type of `BulkOp` used for Get operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type GetOptions

type GetOptions struct {
	WithExpiry bool
	// Project causes the Get operation to only fetch the fields indicated
	// by the paths. The result of the operation is then treated as a
	// standard GetResult.
	Project       []string
	Transcoder    Transcoder
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

GetOptions are the options available to a Get operation.

type GetPendingMutationsAnalyticsOptions

type GetPendingMutationsAnalyticsOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetPendingMutationsAnalyticsOptions is the set of options available to the user manager GetPendingMutations operation.

type GetReplicaResult

type GetReplicaResult struct {
	GetResult
	// contains filtered or unexported fields
}

GetReplicaResult is the return type of GetReplica operations.

func (*GetReplicaResult) IsReplica

func (r *GetReplicaResult) IsReplica() bool

IsReplica returns whether or not this result came from a replica server.

type GetResult

type GetResult struct {
	Result
	// contains filtered or unexported fields
}

GetResult is the return type of Get operations.

func (*GetResult) Content

func (d *GetResult) Content(valuePtr interface{}) error

Content assigns the value of the result into the valuePtr using default decoding.

func (*GetResult) Expiry

func (d *GetResult) Expiry() *time.Duration

Expiry returns the expiry value for the result if it available. Note that a nil pointer indicates that the Expiry was not fetched, while a valid pointer to a zero Duration indicates that the document will never expire. Deprecated: Use ExpiryTime instead.

func (*GetResult) ExpiryTime added in v2.1.6

func (d *GetResult) ExpiryTime() time.Time

ExpiryTime returns the expiry time for the result if it available. This function will return a zero time if the value either was not fetched or the document does not have an expiry time.

type GetRolesOptions

type GetRolesOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetRolesOptions is the set of options available to the user manager GetRoles operation.

type GetSearchIndexOptions

type GetSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetSearchIndexOptions is the set of options available to the search indexes GetIndex operation.

type GetSpecOptions

type GetSpecOptions struct {
	IsXattr bool
}

GetSpecOptions are the options available to LookupIn subdoc Get operations.

type GetUserOptions

type GetUserOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy

	DomainName string
	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

GetUserOptions is the set of options available to the user manager Get operation.

type Group

type Group struct {
	Name               string
	Description        string
	Roles              []Role
	LDAPGroupReference string
}

Group represents a user group on the server.

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"`
	ErrorText     string        `json:"error_text,omitempty"`
	StatusCode    uint32        `json:"status_code,omitempty"`
}

HTTPError is the error type of management HTTP errors. UNCOMMITTED: This API may change in the future.

func (HTTPError) Error

func (e HTTPError) Error() string

Error returns the string representation of this error.

func (HTTPError) MarshalJSON added in v2.2.1

func (e HTTPError) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface.

func (HTTPError) Unwrap

func (e HTTPError) Unwrap() error

Unwrap returns the underlying cause for this error.

type IncrementOp

type IncrementOp struct {
	ID      string
	Delta   int64
	Initial int64
	Expiry  time.Duration

	Result *CounterResult
	Err    error
	// contains filtered or unexported fields
}

IncrementOp represents a type of `BulkOp` used for Increment operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type IncrementOptions

type IncrementOptions struct {
	Timeout time.Duration
	// Expiry is the length of time that the document will be stored in Couchbase.
	// A value of 0 will set the document to never expire.
	Expiry time.Duration
	// Initial, if non-negative, is the `initial` value to use for the document if it does not exist.
	// If present, this is the value that will be returned by a successful operation.
	Initial int64
	// Delta is the value to use for incrementing/decrementing if Initial is not present.
	Delta           uint64
	DurabilityLevel DurabilityLevel
	PersistTo       uint
	ReplicateTo     uint
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan

	// Deprecated: Cas is not supported by the server for Increment, and is no longer used.
	Cas Cas

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

IncrementOptions are the options available to the Increment operation.

type InsertOp

type InsertOp struct {
	ID     string
	Value  interface{}
	Expiry time.Duration
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

InsertOp represents a type of `BulkOp` used for Insert operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type InsertOptions

type InsertOptions struct {
	Expiry          time.Duration
	PersistTo       uint
	ReplicateTo     uint
	DurabilityLevel DurabilityLevel
	Transcoder      Transcoder
	Timeout         time.Duration
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

InsertOptions are options that can be applied to an Insert operation.

type InsertSpecOptions

type InsertSpecOptions struct {
	CreatePath bool
	IsXattr    bool
}

InsertSpecOptions are the options available to subdocument Insert operations.

type InternalBucket added in v2.1.4

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

InternalBucket is used for internal functionality. Internal: This should never be used and is not supported.

func (*InternalBucket) CapabilityStatus added in v2.2.2

func (ib *InternalBucket) CapabilityStatus(cap Capability) (CapabilityStatus, error)

HasCapabilityStatus verifies whether support for a server capability is in a given state.

func (*InternalBucket) IORouter added in v2.1.4

func (ib *InternalBucket) IORouter() (*gocbcore.Agent, error)

IORouter returns the collection's internal core router.

type InternalCluster added in v2.4.1

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

InternalCluster is used for internal functionality. Internal: This should never be used and is not supported.

func (*InternalCluster) GetNodesMetadata added in v2.4.1

func (ic *InternalCluster) GetNodesMetadata(opts *GetNodesMetadataOptions) ([]NodeMetadata, error)

GetNodesMetadata returns a list of information about nodes in the cluster.

type InternalConfig added in v2.1.0

type InternalConfig struct {
	TLSRootCAProvider    func() *x509.CertPool
	ConnectionBufferSize uint
}

InternalConfig specifies options for controlling various internal items. Internal: This should never be used and is not supported.

type InternalTransactionAttemptContext added in v2.4.0

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

InternalTransactionAttemptContext is used for internal dealings. Internal: This should never be used and is not supported.

func (*InternalTransactionAttemptContext) IsExpired added in v2.4.0

func (iac *InternalTransactionAttemptContext) IsExpired() bool

type IoConfig

type IoConfig struct {
	DisableMutationTokens  bool
	DisableServerDurations bool
}

IoConfig specifies IO related configuration options.

type JSONTranscoder

type JSONTranscoder struct {
}

JSONTranscoder implements the default transcoding behavior and applies JSON transcoding to all values.

This will apply the following behavior to the value: binary ([]byte) -> error. default -> JSON value, JSON Flags.

func NewJSONTranscoder

func NewJSONTranscoder() *JSONTranscoder

NewJSONTranscoder returns a new JSONTranscoder.

func (*JSONTranscoder) Decode

func (t *JSONTranscoder) Decode(bytes []byte, flags uint32, out interface{}) error

Decode applies JSON transcoding behaviour to decode into a Go type.

func (*JSONTranscoder) Encode

func (t *JSONTranscoder) Encode(value interface{}) ([]byte, uint32, error)

Encode applies JSON transcoding behaviour to encode a Go type.

type KeyValueError

type KeyValueError struct {
	InnerError         error           `json:"-"`
	StatusCode         memd.StatusCode `json:"status_code,omitempty"`
	DocumentID         string          `json:"document_id,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. UNCOMMITTED: This API may change in the future.

func (KeyValueError) Error

func (e KeyValueError) Error() string

Error returns the string representation of a kv error.

func (KeyValueError) MarshalJSON added in v2.2.1

func (e KeyValueError) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface.

func (KeyValueError) Unwrap

func (e KeyValueError) Unwrap() error

Unwrap returns the underlying reason for the error

type LegacyTranscoder

type LegacyTranscoder struct {
}

LegacyTranscoder implements the behaviour for a backward-compatible transcoder. This transcoder implements behaviour matching that of gocb v1.

This will apply the following behavior to the value: binary ([]byte) -> binary bytes, Binary expectedFlags. string -> string bytes, String expectedFlags. default -> JSON value, JSON expectedFlags.

func NewLegacyTranscoder

func NewLegacyTranscoder() *LegacyTranscoder

NewLegacyTranscoder returns a new LegacyTranscoder.

func (*LegacyTranscoder) Decode

func (t *LegacyTranscoder) Decode(bytes []byte, flags uint32, out interface{}) error

Decode applies legacy transcoding behaviour to decode into a Go type.

func (*LegacyTranscoder) Encode

func (t *LegacyTranscoder) Encode(value interface{}) ([]byte, uint32, error)

Encode applies legacy transcoding behavior to encode a Go type.

type LogLevel

type LogLevel gocbcore.LogLevel

LogLevel specifies the severity of a log message.

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

type LogRedactLevel

type LogRedactLevel uint

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.

gocb.SetLogger(gocb.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.

gocb.SetLogger(gocb.VerboseStdioLogger())

type LoggingMeter added in v2.3.0

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

LoggingMeter is a Meter implementation providing a simplified, but useful, view into current SDK state.

func NewAggregatingMeter added in v2.3.0

func NewAggregatingMeter(opts *AggregatingMeterOptions) *LoggingMeter

NewAggregatingMeter creates a new LoggingMeter. Note that this function will soon be deprecated. Deprecated: See NewLoggingMeter.

func NewLoggingMeter added in v2.4.1

func NewLoggingMeter(opts *LoggingMeterOptions) *LoggingMeter

NewLoggingMeter creates a new LoggingMeter.

func (*LoggingMeter) Counter added in v2.3.0

func (am *LoggingMeter) Counter(_ string, _ map[string]string) (Counter, error)

func (*LoggingMeter) ValueRecorder added in v2.3.0

func (am *LoggingMeter) ValueRecorder(name string, tags map[string]string) (ValueRecorder, error)

type LoggingMeterOptions added in v2.4.1

type LoggingMeterOptions struct {
	EmitInterval time.Duration
}

LoggingMeterOptions is the set of options available when creating a LoggingMeter.

type LookupInOptions

type LookupInOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		DocFlags SubdocDocFlag
		User     string
	}
	// contains filtered or unexported fields
}

LookupInOptions are the set of options available to LookupIn.

type LookupInResult

type LookupInResult struct {
	Result
	// contains filtered or unexported fields
}

LookupInResult is the return type for LookupIn.

func (*LookupInResult) ContentAt

func (lir *LookupInResult) ContentAt(idx uint, valuePtr interface{}) error

ContentAt retrieves the value of the operation by its index. The index is the position of the operation as it was added to the builder.

func (*LookupInResult) Exists

func (lir *LookupInResult) Exists(idx uint) bool

Exists verifies that the item at idx exists.

type LookupInSpec

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

LookupInSpec is the representation of an operation available when calling LookupIn

func CountSpec

func CountSpec(path string, opts *CountSpecOptions) LookupInSpec

CountSpec allows you to retrieve the number of items in an array or keys within an dictionary within an element of a document.

func ExistsSpec

func ExistsSpec(path string, opts *ExistsSpecOptions) LookupInSpec

ExistsSpec is similar to Path(), but does not actually retrieve the value from the server. This may save bandwidth if you only need to check for the existence of a path (without caring for its content). You can check the status of this operation by using .ContentAt (and ignoring the value) or .Exists() on the LookupResult.

func GetSpec

func GetSpec(path string, opts *GetSpecOptions) LookupInSpec

GetSpec indicates a path to be retrieved from the document. The value of the path can later be retrieved from the LookupResult. The path syntax follows query's path syntax (e.g. `foo.bar.baz`).

type LostTransactionsCleaner added in v2.4.0

type LostTransactionsCleaner interface {
	ProcessATR(bucket *Bucket, collection, scope, atrID string) ([]TransactionCleanupAttempt, TransactionsProcessATRStats)
	ProcessClient(bucket *Bucket, collection, scope, clientUUID string) (*TransactionsClientRecordDetails, error)
	RemoveClient(uuid string) error
	Close()
}

LostTransactionsCleaner is responsible for performing cleanup of lost transactions. Internal: This should never be used and is not supported.

func NewLostTransactionsCleanup added in v2.4.0

func NewLostTransactionsCleanup(bucketProvider TransactionsBucketProviderFn, locationProvider TransactionsLostCleanupKeyspaceProviderFn,
	config *TransactionsConfig) LostTransactionsCleaner

NewLostTransactionsCleanup returns a LostTransactionsCleaner implementation. Internal: This should never be used and is not supported.

type Meter added in v2.3.0

type Meter interface {
	Counter(name string, tags map[string]string) (Counter, error)
	ValueRecorder(name string, tags map[string]string) (ValueRecorder, error)
}

Meter handles metrics information for SDK operations.

type MutateInOptions

type MutateInOptions struct {
	Expiry          time.Duration
	Cas             Cas
	PersistTo       uint
	ReplicateTo     uint
	DurabilityLevel DurabilityLevel
	StoreSemantic   StoreSemantics
	Timeout         time.Duration
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan
	PreserveExpiry  bool

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		DocFlags SubdocDocFlag
		User     string
	}
}

MutateInOptions are the set of options available to MutateIn.

type MutateInResult

type MutateInResult struct {
	MutationResult
	// contains filtered or unexported fields
}

MutateInResult is the return type of any mutate in related operations. It contains Cas, mutation tokens and any returned content.

func (MutateInResult) ContentAt

func (mir MutateInResult) ContentAt(idx uint, valuePtr interface{}) error

ContentAt retrieves the value of the operation by its index. The index is the position of the operation as it was added to the builder.

type MutateInSpec

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

MutateInSpec is the representation of an operation available when calling MutateIn

func ArrayAddUniqueSpec

func ArrayAddUniqueSpec(path string, val interface{}, opts *ArrayAddUniqueSpecOptions) MutateInSpec

ArrayAddUniqueSpec adds an dictionary add unique operation to this mutation operation set.

func ArrayAppendSpec

func ArrayAppendSpec(path string, val interface{}, opts *ArrayAppendSpecOptions) MutateInSpec

ArrayAppendSpec adds an element(s) to the end (i.e. right) of an array

func ArrayInsertSpec

func ArrayInsertSpec(path string, val interface{}, opts *ArrayInsertSpecOptions) MutateInSpec

ArrayInsertSpec inserts an element at a given position within an array. The position should be specified as part of the path, e.g. path.to.array[3]

func ArrayPrependSpec

func ArrayPrependSpec(path string, val interface{}, opts *ArrayPrependSpecOptions) MutateInSpec

ArrayPrependSpec adds an element to the beginning (i.e. left) of an array

func DecrementSpec

func DecrementSpec(path string, delta int64, opts *CounterSpecOptions) MutateInSpec

DecrementSpec adds a decrement operation to this mutation operation set.

func IncrementSpec

func IncrementSpec(path string, delta int64, opts *CounterSpecOptions) MutateInSpec

IncrementSpec adds an increment operation to this mutation operation set.

func InsertSpec

func InsertSpec(path string, val interface{}, opts *InsertSpecOptions) MutateInSpec

InsertSpec inserts a value at the specified path within the document.

func RemoveSpec

func RemoveSpec(path string, opts *RemoveSpecOptions) MutateInSpec

RemoveSpec removes the field at path.

func ReplaceSpec

func ReplaceSpec(path string, val interface{}, opts *ReplaceSpecOptions) MutateInSpec

ReplaceSpec replaces the value of the field at path.

func UpsertSpec

func UpsertSpec(path string, val interface{}, opts *UpsertSpecOptions) MutateInSpec

UpsertSpec creates a new value at the specified path within the document if it does not exist, if it does exist then it updates it.

type MutationMacro

type MutationMacro string

MutationMacro can be supplied to MutateIn operations to perform ExpandMacros operations.

const (
	// MutationMacroCAS can be used to tell the server to use the CAS macro.
	MutationMacroCAS MutationMacro = "\"${Mutation.CAS}\""

	// MutationMacroSeqNo can be used to tell the server to use the seqno macro.
	MutationMacroSeqNo MutationMacro = "\"${Mutation.seqno}\""

	// MutationMacroValueCRC32c can be used to tell the server to use the value_crc32c macro.
	MutationMacroValueCRC32c MutationMacro = "\"${Mutation.value_crc32c}\""
)

type MutationResult

type MutationResult struct {
	Result
	// contains filtered or unexported fields
}

MutationResult is the return type of any store related operations. It contains Cas and mutation tokens.

func (MutationResult) MutationToken

func (mr MutationResult) MutationToken() *MutationToken

MutationToken returns the mutation token belonging to an operation.

type MutationState

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

MutationState holds and aggregates MutationToken's across multiple operations.

func NewMutationState

func NewMutationState(tokens ...MutationToken) *MutationState

NewMutationState creates a new MutationState for tracking mutation state.

func (*MutationState) Add

func (mt *MutationState) Add(tokens ...MutationToken)

Add includes an operation's mutation information in this mutation state.

func (*MutationState) Internal added in v2.1.4

func (mt *MutationState) Internal() *MutationStateInternal

Internal return a new MutationStateInternal. Internal: This should never be used and is not supported.

func (*MutationState) MarshalJSON

func (mt *MutationState) MarshalJSON() ([]byte, error)

MarshalJSON marshal's this mutation state to JSON.

func (*MutationState) UnmarshalJSON

func (mt *MutationState) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal's a mutation state from JSON.

type MutationStateInternal added in v2.1.4

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

MutationStateInternal specifies internal operations. Internal: This should never be used and is not supported.

func (*MutationStateInternal) Add added in v2.1.4

func (mti *MutationStateInternal) Add(bucket string, tokens ...gocbcore.MutationToken)

Add includes an operation's mutation information in this mutation state.

func (*MutationStateInternal) Tokens added in v2.1.4

func (mti *MutationStateInternal) Tokens() []MutationToken

Tokens returns the tokens belonging to the mutation state.

type MutationToken

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

MutationToken holds the mutation state information from an operation.

func (MutationToken) BucketName

func (mt MutationToken) BucketName() string

BucketName returns the name of the bucket that this token belongs to.

func (MutationToken) PartitionID

func (mt MutationToken) PartitionID() uint64

PartitionID returns the ID of the vbucket that this token belongs to.

func (MutationToken) PartitionUUID

func (mt MutationToken) PartitionUUID() uint64

PartitionUUID returns the UUID of the vbucket that this token belongs to.

func (MutationToken) SequenceNumber

func (mt MutationToken) SequenceNumber() uint64

SequenceNumber returns the sequence number of the vbucket that this token belongs to.

type NewAzureBlobExternalAnalyticsLinkOptions added in v2.3.0

type NewAzureBlobExternalAnalyticsLinkOptions struct {
	ConnectionString      string
	AccountName           string
	AccountKey            string
	SharedAccessSignature string
	BlobEndpoint          string
	EndpointSuffix        string
}

NewAzureBlobExternalAnalyticsLinkOptions are the options available when creating a new AzureBlobExternalAnalyticsLink. VOLATILE: This API is subject to change at any time.

type NewCouchbaseRemoteAnalyticsLinkOptions added in v2.3.0

type NewCouchbaseRemoteAnalyticsLinkOptions struct {
	Encryption CouchbaseRemoteAnalyticsEncryptionSettings
	Username   string
	Password   string
}

NewCouchbaseRemoteAnalyticsLinkOptions are the options available when creating a new CouchbaseRemoteAnalyticsLink.

type NewS3ExternalAnalyticsLinkOptions added in v2.3.0

type NewS3ExternalAnalyticsLinkOptions struct {
	SessionToken    string
	ServiceEndpoint string
}

NewS3ExternalAnalyticsLinkOptions are the options available when creating a new S3ExternalAnalyticsLink.

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 NodeMetadata added in v2.4.1

type NodeMetadata struct {
	ClusterCompatibility int
	ClusterMembership    string
	CouchAPIBase         string
	Hostname             string
	InterestingStats     map[string]float64
	MCDMemoryAllocated   float64
	MCDMemoryReserved    float64
	MemoryFree           float64
	MemoryTotal          float64
	OS                   string
	Ports                map[string]int
	Status               string
	Uptime               int
	Version              string
	ThisNode             bool
}

NodeMetadata contains information about a node in the cluster. Internal: This should never be used and is not supported.

type NoopMeter added in v2.3.0

type NoopMeter struct {
}

NoopMeter is a Meter implementation which performs no metrics operations.

func (*NoopMeter) Counter added in v2.3.0

func (nm *NoopMeter) Counter(name string, tags map[string]string) (Counter, error)

Counter is used for incrementing a synchronous count metric.

func (*NoopMeter) ValueRecorder added in v2.3.0

func (nm *NoopMeter) ValueRecorder(name string, tags map[string]string) (ValueRecorder, error)

ValueRecorder is used for grouping synchronous count metrics.

type NoopTracer added in v2.3.0

type NoopTracer struct {
}

NoopTracer is a RequestTracer implementation that does not perform any tracing.

func (*NoopTracer) RequestSpan added in v2.3.0

func (tracer *NoopTracer) RequestSpan(parentContext RequestSpanContext, operationName string) RequestSpan

RequestSpan creates a new RequestSpan.

type Origin

type Origin struct {
	Type string
	Name string
}

Origin indicates why a user has a specific role. Is the Origin Type is "user" then the role is assigned directly to the user. If the type is "group" then it means that the role has been inherited from the group identified by the Name field.

type OrphanReporterConfig

type OrphanReporterConfig struct {
	Disabled       bool
	ReportInterval time.Duration
	SampleSize     uint32
}

OrphanReporterConfig specifies options for controlling the orphan reporter which records when the SDK receives responses for requests that are no longer in the system (usually due to being timed out).

type PasswordAuthenticator

type PasswordAuthenticator struct {
	Username string
	Password string
}

PasswordAuthenticator implements an Authenticator which uses an RBAC username and password.

func (PasswordAuthenticator) Certificate

func (ra PasswordAuthenticator) Certificate(req AuthCertRequest) (*tls.Certificate, error)

Certificate returns the certificate to use when connecting to a specified server. VOLATILE: This API is subject to change at any time.

func (PasswordAuthenticator) Credentials

func (ra PasswordAuthenticator) Credentials(req AuthCredsRequest) ([]UserPassPair, error)

Credentials returns the credentials for a particular service. VOLATILE: This API is subject to change at any time.

func (PasswordAuthenticator) SupportsNonTLS

func (ra PasswordAuthenticator) SupportsNonTLS() bool

SupportsNonTLS returns whether this authenticator can authenticate a non-TLS connection. VOLATILE: This API is subject to change at any time.

func (PasswordAuthenticator) SupportsTLS

func (ra PasswordAuthenticator) SupportsTLS() bool

SupportsTLS returns whether this authenticator can authenticate a TLS connection. VOLATILE: This API is subject to change at any time.

type PauseEventingFunctionOptions added in v2.3.2

type PauseEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

PauseEventingFunctionOptions are the options available when using the PauseFunction operation.

type PauseIngestSearchIndexOptions

type PauseIngestSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

PauseIngestSearchIndexOptions is the set of options available to the search index PauseIngest operation.

type PingOptions

type PingOptions struct {
	ServiceTypes []ServiceType
	ReportID     string
	Timeout      time.Duration
	ParentSpan   RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

PingOptions are the options available to the Ping operation.

type PingResult

type PingResult struct {
	ID       string
	Services map[ServiceType][]EndpointPingReport
	// contains filtered or unexported fields
}

PingResult encapsulates the details from a executed ping operation.

func (*PingResult) MarshalJSON

func (report *PingResult) MarshalJSON() ([]byte, error)

MarshalJSON generates a JSON representation of this ping report.

type PingState

type PingState uint

PingState specifies the result of the ping operation

const (
	// PingStateOk indicates that the ping operation was successful.
	PingStateOk PingState = iota + 1

	// PingStateTimeout indicates that the ping operation timed out.
	PingStateTimeout

	// PingStateError indicates that the ping operation failed.
	PingStateError
)

type PrependOp

type PrependOp struct {
	ID     string
	Value  string
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

PrependOp represents a type of `BulkOp` used for Prepend operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type PrependOptions

type PrependOptions struct {
	Timeout         time.Duration
	DurabilityLevel DurabilityLevel
	PersistTo       uint
	ReplicateTo     uint
	Cas             Cas
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

PrependOptions are the options available to the Prepend operation.

type PublishDesignDocumentOptions

type PublishDesignDocumentOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

PublishDesignDocumentOptions is the set of options available to the ViewIndexManager PublishDesignDocument operation.

type QueryError

type QueryError struct {
	InnerError      error            `json:"-"`
	Statement       string           `json:"statement,omitempty"`
	ClientContextID string           `json:"client_context_id,omitempty"`
	Errors          []QueryErrorDesc `json:"errors,omitempty"`
	Endpoint        string           `json:"endpoint,omitempty"`
	RetryReasons    []RetryReason    `json:"retry_reasons,omitempty"`
	RetryAttempts   uint32           `json:"retry_attempts,omitempty"`
	ErrorText       string           `json:"error_text,omitempty"`
	HTTPStatusCode  int              `json:"http_status_code,omitempty"`
}

QueryError is the error type of all query errors. UNCOMMITTED: This API may change in the future.

func (QueryError) Error

func (e QueryError) Error() string

Error returns the string representation of this error.

func (QueryError) MarshalJSON added in v2.2.1

func (e QueryError) MarshalJSON() ([]byte, error)

func (QueryError) Unwrap

func (e QueryError) Unwrap() error

Unwrap returns the underlying cause for this error.

type QueryErrorDesc

type QueryErrorDesc struct {
	Code    uint32
	Message string
	Retry   bool
	Reason  map[string]interface{}
}

QueryErrorDesc represents a specific error returned from the query service.

func (QueryErrorDesc) MarshalJSON added in v2.4.1

func (e QueryErrorDesc) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface.

type QueryIndex

type QueryIndex struct {
	Name           string
	IsPrimary      bool
	Type           QueryIndexType
	State          string
	Keyspace       string
	Namespace      string
	IndexKey       []string
	Condition      string
	Partition      string
	CollectionName string
	ScopeName      string
	BucketName     string
}

QueryIndex represents a Couchbase GSI index.

type QueryIndexManager

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

QueryIndexManager provides methods for performing Couchbase query index management.

func (*QueryIndexManager) BuildDeferredIndexes

func (qm *QueryIndexManager) BuildDeferredIndexes(bucketName string, opts *BuildDeferredQueryIndexOptions) ([]string, error)

BuildDeferredIndexes builds all indexes which are currently in deferred state. If no collection and scope names are specified in the options then *only* indexes created on the bucket directly will be built.

func (*QueryIndexManager) CreateIndex

func (qm *QueryIndexManager) CreateIndex(bucketName, indexName string, keys []string, opts *CreateQueryIndexOptions) error

CreateIndex creates an index over the specified fields. The SDK will automatically escape the provided index keys. For more advanced use cases like index keys using keywords cluster.Query or scope.Query should be used with the query directly.

func (*QueryIndexManager) CreatePrimaryIndex

func (qm *QueryIndexManager) CreatePrimaryIndex(bucketName string, opts *CreatePrimaryQueryIndexOptions) error

CreatePrimaryIndex creates a primary index. An empty customName uses the default naming.

func (*QueryIndexManager) DropIndex

func (qm *QueryIndexManager) DropIndex(bucketName, indexName string, opts *DropQueryIndexOptions) error

DropIndex drops a specific index by name.

func (*QueryIndexManager) DropPrimaryIndex

func (qm *QueryIndexManager) DropPrimaryIndex(bucketName string, opts *DropPrimaryQueryIndexOptions) error

DropPrimaryIndex drops the primary index. Pass an empty customName for unnamed primary indexes.

func (*QueryIndexManager) GetAllIndexes

func (qm *QueryIndexManager) GetAllIndexes(bucketName string, opts *GetAllQueryIndexesOptions) ([]QueryIndex, error)

GetAllIndexes returns a list of all currently registered indexes.

func (*QueryIndexManager) WatchIndexes

func (qm *QueryIndexManager) WatchIndexes(bucketName string, watchList []string, timeout time.Duration, opts *WatchQueryIndexOptions) error

WatchIndexes waits for a set of indexes to come online.

type QueryIndexType

type QueryIndexType string

QueryIndexType provides information on the type of indexer used for an index.

const (
	// QueryIndexTypeGsi indicates that GSI was used to build the index.
	QueryIndexTypeGsi QueryIndexType = "gsi"

	// QueryIndexTypeView indicates that views were used to build the index.
	QueryIndexTypeView QueryIndexType = "views"
)

type QueryMetaData

type QueryMetaData struct {
	RequestID       string
	ClientContextID string
	Status          QueryStatus
	Metrics         QueryMetrics
	Signature       interface{}
	Warnings        []QueryWarning
	Profile         interface{}
	// contains filtered or unexported fields
}

QueryMetaData provides access to the meta-data properties of a query result.

type QueryMetrics

type QueryMetrics struct {
	ElapsedTime   time.Duration
	ExecutionTime time.Duration
	ResultCount   uint64
	ResultSize    uint64
	MutationCount uint64
	SortCount     uint64
	ErrorCount    uint64
	WarningCount  uint64
}

QueryMetrics encapsulates various metrics gathered during a queries execution.

type QueryOptions

type QueryOptions struct {
	ScanConsistency QueryScanConsistency
	ConsistentWith  *MutationState
	Profile         QueryProfileMode

	// ScanCap is the maximum buffered channel size between the indexer connectionManager and the query service for index scans.
	ScanCap uint32

	// PipelineBatch controls the number of items execution operators can batch for Fetch from the KV.
	PipelineBatch uint32

	// PipelineCap controls the maximum number of items each execution operator can buffer between various operators.
	PipelineCap uint32

	// ScanWait is how long the indexer is allowed to wait until it can satisfy ScanConsistency/ConsistentWith criteria.
	ScanWait time.Duration
	Readonly bool

	// MaxParallelism is the maximum number of index partitions, for computing aggregation in parallel.
	MaxParallelism uint32

	// ClientContextID provides a unique ID for this query which can be used matching up requests between connectionManager and
	// server. If not provided will be assigned a uuid value.
	ClientContextID      string
	PositionalParameters []interface{}
	NamedParameters      map[string]interface{}
	Metrics              bool

	// Raw provides a way to provide extra parameters in the request body for the query.
	Raw map[string]interface{}

	Adhoc         bool
	Timeout       time.Duration
	RetryStrategy RetryStrategy

	// FlexIndex tells the query engine to use a flex index (utilizing the search service).
	FlexIndex bool

	// PreserveExpiry tells the query engine to preserve expiration values set on any documents modified by this query.
	PreserveExpiry bool

	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// AsTransaction indicates to run this query as a transaction, providing any additional transaction specific
	// configuration.
	// UNCOMMITTED: This API may change in the future.
	AsTransaction *SingleQueryTransactionOptions

	// Internal: This should never be used and is not supported.
	Internal struct {
		User     string
		Endpoint string
	}
}

QueryOptions represents the options available when executing a query.

type QueryProfileMode

type QueryProfileMode string

QueryProfileMode specifies the profiling mode to use during a query.

const (
	// QueryProfileModeNone disables query profiling
	QueryProfileModeNone QueryProfileMode = "off"

	// QueryProfileModePhases includes phase profiling information in the query response
	QueryProfileModePhases QueryProfileMode = "phases"

	// QueryProfileModeTimings includes timing profiling information in the query response
	QueryProfileModeTimings QueryProfileMode = "timings"
)

type QueryResult

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

QueryResult allows access to the results of a query.

func (*QueryResult) Close

func (r *QueryResult) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*QueryResult) Err

func (r *QueryResult) Err() error

Err returns any errors that have occurred on the stream

func (*QueryResult) Internal added in v2.3.5

func (r *QueryResult) Internal() *QueryResultInternal

Internal provides access to internal only functionality. Internal: This should never be used and is not supported.

func (*QueryResult) MetaData

func (r *QueryResult) MetaData() (*QueryMetaData, error)

MetaData returns any meta-data that was available from this query. Note that the meta-data will only be available once the object has been closed (either implicitly or explicitly).

func (*QueryResult) Next

func (r *QueryResult) Next() bool

Next assigns the next result from the results into the value pointer, returning whether the read was successful.

func (*QueryResult) One

func (r *QueryResult) One(valuePtr interface{}) error

One assigns the first value from the results into the value pointer. It will close the results but not before iterating through all remaining results, as such this should only be used for very small resultsets - ideally of, at most, length 1.

func (*QueryResult) Raw added in v2.2.0

func (r *QueryResult) Raw() *QueryResultRaw

Raw returns a QueryResultRaw which can be used to access the raw byte data from search queries. Calling this function invalidates the underlying QueryResult which will no longer be able to be used. VOLATILE: This API is subject to change at any time.

func (*QueryResult) Row

func (r *QueryResult) Row(valuePtr interface{}) error

Row returns the contents of the current row

type QueryResultInternal added in v2.3.5

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

QueryResultInternal provides access to internal only functionality. Internal: This should never be used and is not supported.

func (*QueryResultInternal) Endpoint added in v2.3.5

func (r *QueryResultInternal) Endpoint() string

Endpoint returns the endpoint that this query was sent to.

type QueryResultRaw added in v2.2.0

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

QueryResultRaw provides raw access to query data. VOLATILE: This API is subject to change at any time.

func (*QueryResultRaw) Close added in v2.2.0

func (qrr *QueryResultRaw) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*QueryResultRaw) Err added in v2.2.0

func (qrr *QueryResultRaw) Err() error

Err returns any errors that have occurred on the stream

func (*QueryResultRaw) MetaData added in v2.2.0

func (qrr *QueryResultRaw) MetaData() ([]byte, error)

MetaData returns any meta-data that was available from this query as bytes.

func (*QueryResultRaw) NextBytes added in v2.2.0

func (qrr *QueryResultRaw) NextBytes() []byte

NextBytes returns the next row as bytes.

type QueryScanConsistency

type QueryScanConsistency uint

QueryScanConsistency indicates the level of data consistency desired for a query.

const (
	// QueryScanConsistencyNotBounded indicates no data consistency is required.
	QueryScanConsistencyNotBounded QueryScanConsistency = iota + 1
	// QueryScanConsistencyRequestPlus indicates that request-level data consistency is required.
	QueryScanConsistencyRequestPlus
)

type QueryStatus

type QueryStatus string

QueryStatus provides information about the current status of a query.

const (
	// QueryStatusRunning indicates the query is still running
	QueryStatusRunning QueryStatus = "running"

	// QueryStatusSuccess indicates the query was successful.
	QueryStatusSuccess QueryStatus = "success"

	// QueryStatusErrors indicates a query completed with errors.
	QueryStatusErrors QueryStatus = "errors"

	// QueryStatusCompleted indicates a query has completed.
	QueryStatusCompleted QueryStatus = "completed"

	// QueryStatusStopped indicates a query has been stopped.
	QueryStatusStopped QueryStatus = "stopped"

	// QueryStatusTimeout indicates a query timed out.
	QueryStatusTimeout QueryStatus = "timeout"

	// QueryStatusClosed indicates that a query was closed.
	QueryStatusClosed QueryStatus = "closed"

	// QueryStatusFatal indicates that a query ended with a fatal error.
	QueryStatusFatal QueryStatus = "fatal"

	// QueryStatusAborted indicates that a query was aborted.
	QueryStatusAborted QueryStatus = "aborted"

	// QueryStatusUnknown indicates that the query status is unknown.
	QueryStatusUnknown QueryStatus = "unknown"
)

type QueryWarning

type QueryWarning struct {
	Code    uint32
	Message string
}

QueryWarning encapsulates any warnings returned by a query.

type RangeScan added in v2.6.1

type RangeScan struct {
	From *ScanTerm
	To   *ScanTerm
}

RangeScan indicates that the Scan operation should scan a range of keys.

func NewRangeScanForPrefix added in v2.6.1

func NewRangeScanForPrefix(prefix string) RangeScan

NewRangeScanForPrefix creates a new range scan for the given prefix, starting at the prefix and ending at the prefix plus maximum. VOLATILE: This API is subject to change at any time.

type RawBinaryTranscoder

type RawBinaryTranscoder struct {
}

RawBinaryTranscoder implements passthrough behavior of raw binary data. This transcoder does not apply any serialization.

This will apply the following behavior to the value: binary ([]byte) -> binary bytes, binary expectedFlags. default -> error.

func NewRawBinaryTranscoder

func NewRawBinaryTranscoder() *RawBinaryTranscoder

NewRawBinaryTranscoder returns a new RawBinaryTranscoder.

func (*RawBinaryTranscoder) Decode

func (t *RawBinaryTranscoder) Decode(bytes []byte, flags uint32, out interface{}) error

Decode applies raw binary transcoding behaviour to decode into a Go type.

func (*RawBinaryTranscoder) Encode

func (t *RawBinaryTranscoder) Encode(value interface{}) ([]byte, uint32, error)

Encode applies raw binary transcoding behaviour to encode a Go type.

type RawJSONTranscoder

type RawJSONTranscoder struct {
}

RawJSONTranscoder implements passthrough behavior of JSON data. This transcoder does not apply any serialization. It will forward data across the network without incurring unnecessary parsing costs.

This will apply the following behavior to the value: binary ([]byte) -> JSON bytes, JSON expectedFlags. string -> JSON bytes, JSON expectedFlags. default -> error.

func NewRawJSONTranscoder

func NewRawJSONTranscoder() *RawJSONTranscoder

NewRawJSONTranscoder returns a new RawJSONTranscoder.

func (*RawJSONTranscoder) Decode

func (t *RawJSONTranscoder) Decode(bytes []byte, flags uint32, out interface{}) error

Decode applies raw JSON transcoding behaviour to decode into a Go type.

func (*RawJSONTranscoder) Encode

func (t *RawJSONTranscoder) Encode(value interface{}) ([]byte, uint32, error)

Encode applies raw JSON transcoding behaviour to encode a Go type.

type RawStringTranscoder

type RawStringTranscoder struct {
}

RawStringTranscoder implements passthrough behavior of raw string data. This transcoder does not apply any serialization.

This will apply the following behavior to the value: string -> string bytes, string expectedFlags. default -> error.

func NewRawStringTranscoder

func NewRawStringTranscoder() *RawStringTranscoder

NewRawStringTranscoder returns a new RawStringTranscoder.

func (*RawStringTranscoder) Decode

func (t *RawStringTranscoder) Decode(bytes []byte, flags uint32, out interface{}) error

Decode applies raw string transcoding behaviour to decode into a Go type.

func (*RawStringTranscoder) Encode

func (t *RawStringTranscoder) Encode(value interface{}) ([]byte, uint32, error)

Encode applies raw string transcoding behaviour to encode a Go type.

type RemoveOp

type RemoveOp struct {
	ID     string
	Cas    Cas
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

RemoveOp represents a type of `BulkOp` used for Remove operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type RemoveOptions

type RemoveOptions struct {
	Cas             Cas
	PersistTo       uint
	ReplicateTo     uint
	DurabilityLevel DurabilityLevel
	Timeout         time.Duration
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

RemoveOptions are the options available to the Remove command.

type RemoveSpecOptions

type RemoveSpecOptions struct {
	IsXattr bool
}

RemoveSpecOptions are the options available to subdocument Remove operations.

type ReplaceAnalyticsLinkOptions added in v2.3.0

type ReplaceAnalyticsLinkOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

ReplaceAnalyticsLinkOptions is the set of options available to the analytics manager ReplaceLink function.

type ReplaceOp

type ReplaceOp struct {
	ID     string
	Value  interface{}
	Expiry time.Duration
	Cas    Cas
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

ReplaceOp represents a type of `BulkOp` used for Replace operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type ReplaceOptions

type ReplaceOptions struct {
	Expiry          time.Duration
	Cas             Cas
	PersistTo       uint
	ReplicateTo     uint
	DurabilityLevel DurabilityLevel
	Transcoder      Transcoder
	Timeout         time.Duration
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan
	PreserveExpiry  bool

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

ReplaceOptions are the options available to a Replace operation.

type ReplaceSpecOptions

type ReplaceSpecOptions struct {
	IsXattr bool
}

ReplaceSpecOptions are the options available to subdocument Replace operations.

type RequestSpan added in v2.3.0

type RequestSpan interface {
	End()
	Context() RequestSpanContext
	AddEvent(name string, timestamp time.Time)
	SetAttribute(key string, value interface{})
}

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

type RequestSpanContext added in v2.3.0

type RequestSpanContext interface {
}

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

type RequestTracer added in v2.3.0

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

RequestTracer describes the tracing abstraction in the SDK.

type Result

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

Result is the base type for the return types of operations

func (*Result) Cas

func (d *Result) Cas() Cas

Cas returns the cas of the result.

type ResumeEventingFunctionOptions added in v2.3.2

type ResumeEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

ResumeEventingFunctionOptions are the options available when using the ResumeFunction operation.

type ResumeIngestSearchIndexOptions

type ResumeIngestSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

ResumeIngestSearchIndexOptions is the set of options available to the search index ResumeIngest operation.

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
}

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 Role

type Role struct {
	Name       string `json:"role"`
	Bucket     string `json:"bucket_name"`
	Scope      string `json:"scope_name"`
	Collection string `json:"collection_name"`
}

Role represents a specific permission.

type RoleAndDescription

type RoleAndDescription struct {
	Role

	DisplayName string
	Description string
}

RoleAndDescription represents a role with its display name and description.

type RoleAndOrigins

type RoleAndOrigins struct {
	Role

	Origins []Origin
}

RoleAndOrigins associates a role with its origins.

type S3ExternalAnalyticsLink struct {
	Dataverse       string
	LinkName        string
	AccessKeyID     string
	SecretAccessKey string
	// SessionToken is only available in 7.0+.
	SessionToken    string
	Region          string
	ServiceEndpoint string
}

S3ExternalAnalyticsLink describes an external analytics link which uses the AWS S3 service to access data.

func NewS3ExternalAnalyticsLink(linkName, dataverseName, accessKeyID, secretAccessKey, region string,
	opts *NewS3ExternalAnalyticsLinkOptions) *S3ExternalAnalyticsLink

NewS3ExternalAnalyticsLink creates a new S3ExternalAnalyticsLink with the scope field populated. Scope is the analytics scope in the form of "bucket/scope".

func (*S3ExternalAnalyticsLink) DataverseName added in v2.3.0

func (al *S3ExternalAnalyticsLink) DataverseName() string

DataverseName returns the name of the dataverse that this link belongs to.

func (*S3ExternalAnalyticsLink) FormEncode added in v2.3.0

func (al *S3ExternalAnalyticsLink) FormEncode() ([]byte, error)

FormEncode encodes the link into a form data representation, to sent as the body of a CreateLink or ReplaceLink request.

func (*S3ExternalAnalyticsLink) LinkType added in v2.3.0

LinkType returns the type of analytics type this link is: AnalyticsLinkTypeS3External.

func (*S3ExternalAnalyticsLink) Name added in v2.3.0

func (al *S3ExternalAnalyticsLink) Name() string

Name returns the name of this link.

func (*S3ExternalAnalyticsLink) Validate added in v2.3.0

func (al *S3ExternalAnalyticsLink) Validate() error

Validate is used by CreateLink and ReplaceLink to ensure that the link is valid.

type SamplingScan added in v2.6.1

type SamplingScan struct {
	Limit uint64
	Seed  uint64
}

SamplingScan indicates that the Scan operation should perform random sampling.

type SaslMechanism added in v2.1.5

type SaslMechanism string

SaslMechanism represents a type of auth that can be performed.

const (
	// PlainSaslMechanism represents that PLAIN auth should be performed.
	PlainSaslMechanism SaslMechanism = SaslMechanism(gocbcore.PlainAuthMechanism)

	// ScramSha1SaslMechanism represents that SCRAM SHA1 auth should be performed.
	ScramSha1SaslMechanism SaslMechanism = SaslMechanism(gocbcore.ScramSha1AuthMechanism)

	// ScramSha256SaslMechanism represents that SCRAM SHA256 auth should be performed.
	ScramSha256SaslMechanism SaslMechanism = SaslMechanism(gocbcore.ScramSha256AuthMechanism)

	// ScramSha512SaslMechanism represents that SCRAM SHA512 auth should be performed.
	ScramSha512SaslMechanism SaslMechanism = SaslMechanism(gocbcore.ScramSha512AuthMechanism)
)

type ScanOptions added in v2.6.1

type ScanOptions struct {
	Transcoder    Transcoder
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	IDsOnly        bool
	ConsistentWith *MutationState
	Sort           ScanSort

	// BatchByteLimit specifies a limit to how many bytes are sent from server to client on each partition batch.
	BatchByteLimit uint32
	// BatchItemLimit specifies a limit to how many items are sent from server to client on each partition batch.
	BatchItemLimit uint32

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

ScanOptions are the set of options available to the Scan operation. VOLATILE: This API is subject to change at any time.

type ScanResult added in v2.6.1

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

ScanResult is the return type of Scan operations. VOLATILE: This API is subject to change at any time.

func (*ScanResult) Close added in v2.6.1

func (sr *ScanResult) Close() error

Close cancels the stream, returning any errors that occurred during reading the results.

func (*ScanResult) Err added in v2.6.1

func (sr *ScanResult) Err() error

Err returns any errors that have occurred on the stream.

func (*ScanResult) Next added in v2.6.1

func (sr *ScanResult) Next() *ScanResultItem

Next returns the next item on the stream, if there are no items remaining then nil is returned.

type ScanResultItem added in v2.6.1

type ScanResultItem struct {
	Result
	// contains filtered or unexported fields
}

ScanResultItem represents an item that is returning on the stream from a Scan operation.

func (*ScanResultItem) Cas added in v2.6.1

func (sri *ScanResultItem) Cas() Cas

Cas returns the Cas of the item.

func (*ScanResultItem) Content added in v2.6.1

func (sri *ScanResultItem) Content(valuePtr interface{}) error

Content assigns the value of the result into the valuePtr using default decoding. If IDsOnly was set on the ScanOptions then this will return an error.

func (*ScanResultItem) ExpiryTime added in v2.6.1

func (sri *ScanResultItem) ExpiryTime() time.Time

ExpiryTime returns the expiry time for the result if available. This function will return a zero time if the value either was not fetched or the document does not have an expiry time.

func (*ScanResultItem) ID added in v2.6.1

func (sri *ScanResultItem) ID() string

ID returns the id of the item.

func (*ScanResultItem) IDOnly added in v2.6.1

func (sri *ScanResultItem) IDOnly() bool

IDOnly returns whether the scan generating this item was made with IDsOnly set.

type ScanSort added in v2.6.1

type ScanSort uint8

ScanSort represents the sort order of a Scan operation.

const (
	// ScanSortNone indicates that no sorting should be applied during a Scan operation.
	ScanSortNone ScanSort = iota

	// ScanSortAscending indicates that ascending sort should be applied during a Scan operation.
	ScanSortAscending
)

type ScanTerm added in v2.6.1

type ScanTerm struct {
	Term      string
	Exclusive bool
}

ScanTerm represents a term that can be used during a Scan operation.

func ScanTermMaximum added in v2.6.1

func ScanTermMaximum() *ScanTerm

ScanTermMaximum represents the maximum value that a ScanTerm can represent.

func ScanTermMinimum added in v2.6.1

func ScanTermMinimum() *ScanTerm

ScanTermMinimum represents the minimum value that a ScanTerm can represent.

type ScanType added in v2.6.1

type ScanType interface {
	// contains filtered or unexported methods
}

ScanType represents the mode of execution to use for a Scan operation.

type Scope

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

Scope represents a single scope within a bucket.

func (*Scope) AnalyticsQuery added in v2.1.7

func (s *Scope) AnalyticsQuery(statement string, opts *AnalyticsOptions) (*AnalyticsResult, error)

AnalyticsQuery executes the analytics query statement on the server, constraining the query to the bucket and scope.

func (*Scope) BucketName added in v2.1.4

func (s *Scope) BucketName() string

BucketName returns the name of the bucket to which this collection belongs. UNCOMMITTED: This API may change in the future.

func (*Scope) Collection

func (s *Scope) Collection(collectionName string) *Collection

Collection returns an instance of a collection.

func (*Scope) Name

func (s *Scope) Name() string

Name returns the name of the scope.

func (*Scope) Query added in v2.1.7

func (s *Scope) Query(statement string, opts *QueryOptions) (*QueryResult, error)

Query executes the query statement on the server, constraining the query to the bucket and scope.

type ScopeSpec

type ScopeSpec struct {
	Name        string
	Collections []CollectionSpec
}

ScopeSpec describes the specification of a scope.

type SearchDateRangeFacetResult added in v2.1.7

type SearchDateRangeFacetResult struct {
	Name  string
	Start string
	End   string
	Count int
}

SearchDateRangeFacetResult holds the results of a date facet in search results.

type SearchError

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

SearchError is the error type of all search query errors. UNCOMMITTED: This API may change in the future.

func (SearchError) Error

func (e SearchError) Error() string

Error returns the string representation of this error.

func (SearchError) MarshalJSON added in v2.2.1

func (e SearchError) MarshalJSON() ([]byte, error)

func (SearchError) Unwrap

func (e SearchError) Unwrap() error

Unwrap returns the underlying cause for this error.

type SearchFacetResult

type SearchFacetResult struct {
	Name          string
	Field         string
	Total         uint64
	Missing       uint64
	Other         uint64
	Terms         []SearchTermFacetResult
	NumericRanges []SearchNumericRangeFacetResult
	DateRanges    []SearchDateRangeFacetResult
}

SearchFacetResult provides access to the result of a faceted query.

type SearchHighlightOptions

type SearchHighlightOptions struct {
	Style  SearchHighlightStyle
	Fields []string
}

SearchHighlightOptions are the options available for search highlighting.

type SearchHighlightStyle

type SearchHighlightStyle string

SearchHighlightStyle indicates the type of highlighting to use for a search query.

const (
	// DefaultHighlightStyle specifies to use the default to highlight search result hits.
	DefaultHighlightStyle SearchHighlightStyle = ""

	// HTMLHighlightStyle specifies to use HTML tags to highlight search result hits.
	HTMLHighlightStyle SearchHighlightStyle = "html"

	// AnsiHightlightStyle specifies to use ANSI tags to highlight search result hits.
	AnsiHightlightStyle SearchHighlightStyle = "ansi"
)

type SearchIndex

type SearchIndex struct {
	// UUID is required for updates. It provides a means of ensuring consistency, the UUID must match the UUID value
	// for the index on the server.
	UUID string
	// Name represents the name of this index.
	Name string
	// SourceName is the name of the source of the data for the index e.g. bucket name.
	SourceName string
	// Type is the type of index, e.g. fulltext-index or fulltext-alias.
	Type string
	// IndexParams are index properties such as store type and mappings.
	Params map[string]interface{}
	// SourceUUID is the UUID of the data source, this can be used to more tightly tie the index to a source.
	SourceUUID string
	// SourceParams are extra parameters to be defined. These are usually things like advanced connection and tuning
	// parameters.
	SourceParams map[string]interface{}
	// SourceType is the type of the data source, e.g. couchbase or nil depending on the Type field.
	SourceType string
	// PlanParams are plan properties such as number of replicas and number of partitions.
	PlanParams map[string]interface{}
}

SearchIndex is used to define a search index.

type SearchIndexManager

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

SearchIndexManager provides methods for performing Couchbase search index management.

func (*SearchIndexManager) AllowQuerying

func (sm *SearchIndexManager) AllowQuerying(indexName string, opts *AllowQueryingSearchIndexOptions) error

AllowQuerying allows querying against an index.

func (*SearchIndexManager) AnalyzeDocument

func (sm *SearchIndexManager) AnalyzeDocument(indexName string, doc interface{}, opts *AnalyzeDocumentOptions) ([]interface{}, error)

AnalyzeDocument returns how a doc is analyzed against a specific index.

func (*SearchIndexManager) DisallowQuerying

func (sm *SearchIndexManager) DisallowQuerying(indexName string, opts *AllowQueryingSearchIndexOptions) error

DisallowQuerying disallows querying against an index.

func (*SearchIndexManager) DropIndex

func (sm *SearchIndexManager) DropIndex(indexName string, opts *DropSearchIndexOptions) error

DropIndex removes the search index with the specific name.

func (*SearchIndexManager) FreezePlan

func (sm *SearchIndexManager) FreezePlan(indexName string, opts *AllowQueryingSearchIndexOptions) error

FreezePlan freezes the assignment of index partitions to nodes.

func (*SearchIndexManager) GetAllIndexes

func (sm *SearchIndexManager) GetAllIndexes(opts *GetAllSearchIndexOptions) ([]SearchIndex, error)

GetAllIndexes retrieves all of the search indexes for the cluster.

func (*SearchIndexManager) GetIndex

func (sm *SearchIndexManager) GetIndex(indexName string, opts *GetSearchIndexOptions) (*SearchIndex, error)

GetIndex retrieves a specific search index by name.

func (*SearchIndexManager) GetIndexedDocumentsCount

func (sm *SearchIndexManager) GetIndexedDocumentsCount(indexName string, opts *GetIndexedDocumentsCountOptions) (uint64, error)

GetIndexedDocumentsCount retrieves the document count for a search index.

func (*SearchIndexManager) PauseIngest

func (sm *SearchIndexManager) PauseIngest(indexName string, opts *PauseIngestSearchIndexOptions) error

PauseIngest pauses updates and maintenance for an index.

func (*SearchIndexManager) ResumeIngest

func (sm *SearchIndexManager) ResumeIngest(indexName string, opts *ResumeIngestSearchIndexOptions) error

ResumeIngest resumes updates and maintenance for an index.

func (*SearchIndexManager) UnfreezePlan

func (sm *SearchIndexManager) UnfreezePlan(indexName string, opts *AllowQueryingSearchIndexOptions) error

UnfreezePlan unfreezes the assignment of index partitions to nodes.

func (*SearchIndexManager) UpsertIndex

func (sm *SearchIndexManager) UpsertIndex(indexDefinition SearchIndex, opts *UpsertSearchIndexOptions) error

UpsertIndex creates or updates a search index.

type SearchMetaData

type SearchMetaData struct {
	Metrics SearchMetrics
	Errors  map[string]string
}

SearchMetaData provides access to the meta-data properties of a search query result.

type SearchMetrics

type SearchMetrics struct {
	Took                  time.Duration
	TotalRows             uint64
	MaxScore              float64
	TotalPartitionCount   uint64
	SuccessPartitionCount uint64
	ErrorPartitionCount   uint64
}

SearchMetrics encapsulates various metrics gathered during a search queries execution.

type SearchNumericRangeFacetResult added in v2.1.7

type SearchNumericRangeFacetResult struct {
	Name  string
	Min   float64
	Max   float64
	Count int
}

SearchNumericRangeFacetResult holds the results of a numeric facet in search results.

type SearchOptions

type SearchOptions struct {
	ScanConsistency SearchScanConsistency
	Limit           uint32
	Skip            uint32
	Explain         bool
	Highlight       *SearchHighlightOptions
	Fields          []string
	Sort            []cbsearch.Sort
	Facets          map[string]cbsearch.Facet
	ConsistentWith  *MutationState

	// Raw provides a way to provide extra parameters in the request body for the query.
	Raw map[string]interface{}

	Timeout       time.Duration
	RetryStrategy RetryStrategy

	DisableScoring bool

	Collections []string

	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// If set to true, will include the SearchRowLocations.
	IncludeLocations bool

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

SearchOptions represents a pending search query.

type SearchResult

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

SearchResult allows access to the results of a search query.

func (*SearchResult) Close

func (r *SearchResult) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*SearchResult) Err

func (r *SearchResult) Err() error

Err returns any errors that have occurred on the stream

func (*SearchResult) Facets

func (r *SearchResult) Facets() (map[string]SearchFacetResult, error)

Facets returns any facets that were returned with this query. Note that the facets will only be available once the object has been closed (either implicitly or explicitly).

func (*SearchResult) MetaData

func (r *SearchResult) MetaData() (*SearchMetaData, error)

MetaData returns any meta-data that was available from this query. Note that the meta-data will only be available once the object has been closed (either implicitly or explicitly).

func (*SearchResult) Next

func (r *SearchResult) Next() bool

Next assigns the next result from the results into the value pointer, returning whether the read was successful.

func (*SearchResult) Raw added in v2.2.0

func (r *SearchResult) Raw() *SearchResultRaw

Raw returns a SearchResultRaw which can be used to access the raw byte data from search queries. Calling this function invalidates the underlying SearchResult which will no longer be able to be used. VOLATILE: This API is subject to change at any time.

func (*SearchResult) Row

func (r *SearchResult) Row() SearchRow

Row returns the contents of the current row.

type SearchResultRaw added in v2.2.0

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

SearchResultRaw provides raw access to search data. VOLATILE: This API is subject to change at any time.

func (*SearchResultRaw) Close added in v2.2.0

func (srr *SearchResultRaw) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*SearchResultRaw) Err added in v2.2.0

func (srr *SearchResultRaw) Err() error

Err returns any errors that have occurred on the stream

func (*SearchResultRaw) MetaData added in v2.2.0

func (srr *SearchResultRaw) MetaData() ([]byte, error)

MetaData returns any meta-data that was available from this query as bytes.

func (*SearchResultRaw) NextBytes added in v2.2.0

func (srr *SearchResultRaw) NextBytes() []byte

NextBytes returns the next row as bytes.

type SearchRow

type SearchRow struct {
	Index       string
	ID          string
	Score       float64
	Explanation interface{}
	Locations   map[string]map[string][]SearchRowLocation
	Fragments   map[string][]string
	// contains filtered or unexported fields
}

SearchRow represents a single hit returned from a search query.

func (*SearchRow) Fields

func (sr *SearchRow) Fields(valuePtr interface{}) error

Fields decodes the fields included in a search hit.

type SearchRowLocation

type SearchRowLocation struct {
	Position       uint32
	Start          uint32
	End            uint32
	ArrayPositions []uint32
}

SearchRowLocation represents the location of a row match

type SearchScanConsistency

type SearchScanConsistency uint

SearchScanConsistency indicates the level of data consistency desired for a search query.

const (

	// SearchScanConsistencyNotBounded indicates no data consistency is required.
	SearchScanConsistencyNotBounded SearchScanConsistency
)

type SearchTermFacetResult added in v2.1.7

type SearchTermFacetResult struct {
	Term  string
	Count int
}

SearchTermFacetResult holds the results of a term facet in search results.

type SecurityConfig

type SecurityConfig struct {
	TLSRootCAs    *x509.CertPool
	TLSSkipVerify bool

	// AllowedSaslMechanisms is the list of mechanisms that the SDK can use to attempt authentication.
	// Note that if you add PLAIN to the list, this will cause credential leakage on the network
	// since PLAIN sends the credentials in cleartext. It is disabled by default to prevent downgrade attacks. We
	// recommend using a TLS connection if using PLAIN.
	AllowedSaslMechanisms []SaslMechanism
}

SecurityConfig specifies options for controlling security related items such as TLS root certificates and verification skipping.

type ServiceType

type ServiceType gocbcore.ServiceType

ServiceType specifies a particular Couchbase service type.

const (
	// ServiceTypeManagement represents a management service.
	ServiceTypeManagement ServiceType = ServiceType(gocbcore.MgmtService)

	// ServiceTypeKeyValue represents a memcached service.
	ServiceTypeKeyValue ServiceType = ServiceType(gocbcore.MemdService)

	// ServiceTypeViews represents a views service.
	ServiceTypeViews ServiceType = ServiceType(gocbcore.CapiService)

	// ServiceTypeQuery represents a query service.
	ServiceTypeQuery ServiceType = ServiceType(gocbcore.N1qlService)

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

	// ServiceTypeAnalytics represents an analytics service.
	ServiceTypeAnalytics ServiceType = ServiceType(gocbcore.CbasService)

	// ServiceTypeEventing represents an eventing service.
	ServiceTypeEventing ServiceType = ServiceType(gocbcore.EventingService)
)

type SingleQueryTransactionOptions added in v2.5.1

type SingleQueryTransactionOptions struct {
	DurabilityLevel DurabilityLevel

	// Internal specifies a set of options for internal use.
	// Internal: This should never be used and is not supported.
	Internal struct {
		Hooks TransactionHooks
	}
}

SingleQueryTransactionOptions specifies various tunable query options related to single query transactions.

type StorageBackend added in v2.3.5

type StorageBackend string

StorageBackend specifies the storage type to use for the bucket.

const (
	// StorageBackendCouchstore specifies to use the couchstore storage type.
	StorageBackendCouchstore StorageBackend = "couchstore"

	// StorageBackendMagma specifies to use the magma storage type. EE only.
	StorageBackendMagma StorageBackend = "magma"
)

type StoreSemantics

type StoreSemantics uint8

StoreSemantics is used to define the document level action to take during a MutateIn operation.

const (
	// StoreSemanticsReplace signifies to Replace the document, and fail if it does not exist.
	// This is the default action
	StoreSemanticsReplace StoreSemantics = iota

	// StoreSemanticsUpsert signifies to replace the document or create it if it doesn't exist.
	StoreSemanticsUpsert

	// StoreSemanticsInsert signifies to create the document, and fail if it exists.
	StoreSemanticsInsert
)

type SubdocDocFlag

type SubdocDocFlag memd.SubdocDocFlag

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

const (
	// SubdocDocFlagNone indicates no special behaviours
	SubdocDocFlagNone SubdocDocFlag = SubdocDocFlag(memd.SubdocDocFlagNone)

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

	// SubdocDocFlagAddDoc indices that the document should be created only if it does not already exist.
	SubdocDocFlagAddDoc SubdocDocFlag = SubdocDocFlag(memd.SubdocDocFlagAddDoc)

	// SubdocDocFlagAccessDeleted indicates that you wish to receive soft-deleted documents.
	// Internal: This should never be used and is not supported.
	SubdocDocFlagAccessDeleted SubdocDocFlag = SubdocDocFlag(memd.SubdocDocFlagAccessDeleted)

	// SubdocDocFlagCreateAsDeleted indicates that you wish to create a document in deleted state.
	// Internal: This should never be used and is not supported.
	SubdocDocFlagCreateAsDeleted SubdocDocFlag = SubdocDocFlag(memd.SubdocDocFlagCreateAsDeleted)
)

type SubdocFlag

type SubdocFlag memd.SubdocFlag

SubdocFlag provides special handling flags for sub-document operations

const (
	// SubdocFlagNone indicates no special behaviours
	SubdocFlagNone SubdocFlag = SubdocFlag(memd.SubdocFlagNone)

	// SubdocFlagCreatePath indicates you wish to recursively create the tree of paths
	// if it does not already exist within the document.
	SubdocFlagCreatePath SubdocFlag = SubdocFlag(memd.SubdocFlagMkDirP)

	// SubdocFlagXattr indicates your path refers to an extended attribute rather than the document.
	SubdocFlagXattr SubdocFlag = SubdocFlag(memd.SubdocFlagXattrPath)

	// SubdocFlagUseMacros indicates that you wish macro substitution to occur on the value
	SubdocFlagUseMacros SubdocFlag = SubdocFlag(memd.SubdocFlagExpandMacros)
)

type ThresholdLoggingOptions

type ThresholdLoggingOptions struct {
	Interval            time.Duration
	SampleSize          uint32
	KVThreshold         time.Duration
	KVScanThreshold     time.Duration
	ViewsThreshold      time.Duration
	QueryThreshold      time.Duration
	SearchThreshold     time.Duration
	AnalyticsThreshold  time.Duration
	ManagementThreshold time.Duration
}

ThresholdLoggingOptions is the set of options available for configuring threshold logging.

type ThresholdLoggingTracer added in v2.1.5

type ThresholdLoggingTracer struct {
	Interval            time.Duration
	SampleSize          uint32
	KVThreshold         time.Duration
	KVScanThreshold     time.Duration
	ViewsThreshold      time.Duration
	QueryThreshold      time.Duration
	SearchThreshold     time.Duration
	AnalyticsThreshold  time.Duration
	ManagementThreshold time.Duration
	// contains filtered or unexported fields
}

ThresholdLoggingTracer is a specialized Tracer implementation which will automatically log operations which fall outside of a set of thresholds. Note that this tracer is only safe for use within the Couchbase SDK, uses by external event sources are likely to fail.

func NewThresholdLoggingTracer added in v2.1.5

func NewThresholdLoggingTracer(opts *ThresholdLoggingOptions) *ThresholdLoggingTracer

func (*ThresholdLoggingTracer) AddRef added in v2.1.5

func (t *ThresholdLoggingTracer) AddRef() int32

AddRef is used internally to keep track of the number of Cluster instances referring to it. This is used to correctly shut down the aggregation routines once there are no longer any instances tracing to it.

func (*ThresholdLoggingTracer) DecRef added in v2.1.5

func (t *ThresholdLoggingTracer) DecRef() int32

DecRef is the counterpart to AddRef (see AddRef for more information).

func (*ThresholdLoggingTracer) RequestSpan added in v2.3.0

func (t *ThresholdLoggingTracer) RequestSpan(parentContext RequestSpanContext, operationName string) RequestSpan

RequestSpan belongs to the Tracer interface.

type TimeoutError added in v2.1.1

type TimeoutError struct {
	InnerError         error
	OperationID        string
	Opaque             string
	TimeObserved       time.Duration
	RetryReasons       []RetryReason
	RetryAttempts      uint32
	LastDispatchedTo   string
	LastDispatchedFrom string
	LastConnectionID   string
}

TimeoutError wraps timeout errors that occur within the SDK. UNCOMMITTED: This API may change in the future.

func (TimeoutError) Error added in v2.1.1

func (err TimeoutError) Error() string

func (*TimeoutError) MarshalJSON added in v2.1.1

func (err *TimeoutError) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface.

func (*TimeoutError) UnmarshalJSON added in v2.1.1

func (err *TimeoutError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (TimeoutError) Unwrap added in v2.1.1

func (err TimeoutError) Unwrap() error

Unwrap returns the underlying reason for the error

type TimeoutsConfig

type TimeoutsConfig struct {
	ConnectTimeout   time.Duration
	KVTimeout        time.Duration
	KVDurableTimeout time.Duration
	// Volatile: This option is subject to change at any time.
	KVScanTimeout     time.Duration
	ViewTimeout       time.Duration
	QueryTimeout      time.Duration
	AnalyticsTimeout  time.Duration
	SearchTimeout     time.Duration
	ManagementTimeout time.Duration
}

TimeoutsConfig specifies options for various operation timeouts.

type TouchOp

type TouchOp struct {
	ID     string
	Expiry time.Duration
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

TouchOp represents a type of `BulkOp` used for Touch operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type TouchOptions

type TouchOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

TouchOptions are the options available to the Touch operation.

type TransactionAttemptContext added in v2.4.0

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

TransactionAttemptContext represents a single attempt to execute a transaction.

func (*TransactionAttemptContext) Get added in v2.4.0

Get will attempt to fetch a document, and fail the transaction if it does not exist.

func (*TransactionAttemptContext) Insert added in v2.4.0

func (c *TransactionAttemptContext) Insert(collection *Collection, id string, value interface{}) (*TransactionGetResult, error)

Insert will insert a new document, failing if the document already exists.

func (*TransactionAttemptContext) Internal added in v2.4.0

Internal is used for internal dealings. Internal: This should never be used and is not supported.

func (*TransactionAttemptContext) Query added in v2.4.0

Query executes the query statement on the server.

func (*TransactionAttemptContext) Remove added in v2.4.0

Remove will delete a document.

func (*TransactionAttemptContext) Replace added in v2.4.0

func (c *TransactionAttemptContext) Replace(doc *TransactionGetResult, value interface{}) (*TransactionGetResult, error)

Replace will replace the contents of a document, failing if the document does not already exist.

type TransactionAttemptState added in v2.4.0

type TransactionAttemptState int

TransactionAttemptState represents the current state of a transaction attempt. Internal: This should never be used and is not supported.

type TransactionCleanupAttempt added in v2.4.0

type TransactionCleanupAttempt struct {
	Success           bool
	IsReqular         bool
	AttemptID         string
	AtrID             string
	AtrCollectionName string
	AtrScopeName      string
	AtrBucketName     string
	Request           *TransactionCleanupRequest
}

TransactionCleanupAttempt represents the result of running cleanup for a transaction transactionAttempt. Internal: This should never be used and is not supported.

type TransactionCleanupHooks added in v2.4.0

type TransactionCleanupHooks interface {
	BeforeATRGet(id string) error
	BeforeDocGet(id string) error
	BeforeRemoveLinks(id string) error
	BeforeCommitDoc(id string) error
	BeforeRemoveDocStagedForRemoval(id string) error
	BeforeRemoveDoc(id string) error
	BeforeATRRemove(id string) error
}

TransactionCleanupHooks provides a number of internal hooks used for testing. Internal: This should never be used and is not supported.

type TransactionCleanupRequest added in v2.4.0

type TransactionCleanupRequest struct {
	AttemptID         string
	AtrID             string
	AtrCollectionName string
	AtrScopeName      string
	AtrBucketName     string
	Inserts           []TransactionDocRecord
	Replaces          []TransactionDocRecord
	Removes           []TransactionDocRecord
	State             TransactionAttemptState
	ForwardCompat     map[string][]TransactionsForwardCompatibilityEntry
}

TransactionCleanupRequest represents a complete transaction transactionAttempt that requires cleanup. Internal: This should never be used and is not supported.

type TransactionClientRecordHooks added in v2.4.0

type TransactionClientRecordHooks interface {
	BeforeCreateRecord() error
	BeforeRemoveClient() error
	BeforeUpdateCAS() error
	BeforeGetRecord() error
	BeforeUpdateRecord() error
}

TransactionClientRecordHooks provides a number of internal hooks used for testing. Internal: This should never be used and is not supported.

type TransactionCommitAmbiguousError added in v2.4.0

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

func (TransactionCommitAmbiguousError) Error added in v2.4.0

func (TransactionCommitAmbiguousError) Result added in v2.4.0

Internal: This should never be used and is not supported.

func (TransactionCommitAmbiguousError) Unwrap added in v2.4.0

type TransactionDocRecord added in v2.4.0

type TransactionDocRecord struct {
	CollectionName string
	ScopeName      string
	BucketName     string
	ID             string
}

TransactionDocRecord represents an individual document operation requiring cleanup. Internal: This should never be used and is not supported.

type TransactionErrorReason added in v2.5.3

type TransactionErrorReason uint8

TransactionErrorReason is the reason why a transaction should be failed. Internal: This should never be used and is not supported.

type TransactionExpiredError added in v2.4.0

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

func (TransactionExpiredError) Error added in v2.4.0

func (tfe TransactionExpiredError) Error() string

func (TransactionExpiredError) Result added in v2.4.0

Internal: This should never be used and is not supported.

func (TransactionExpiredError) Unwrap added in v2.4.0

func (tfe TransactionExpiredError) Unwrap() error

type TransactionFailedError added in v2.4.0

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

func (TransactionFailedError) Error added in v2.4.0

func (tfe TransactionFailedError) Error() string

func (TransactionFailedError) Result added in v2.4.0

Internal: This should never be used and is not supported.

func (TransactionFailedError) Unwrap added in v2.4.0

func (tfe TransactionFailedError) Unwrap() error

type TransactionFailedPostCommit added in v2.4.0

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

func (TransactionFailedPostCommit) Error added in v2.4.0

func (tfe TransactionFailedPostCommit) Error() string

func (TransactionFailedPostCommit) Result added in v2.4.0

Internal: This should never be used and is not supported.

func (TransactionFailedPostCommit) Unwrap added in v2.4.0

func (tfe TransactionFailedPostCommit) Unwrap() error

type TransactionGetResult added in v2.4.0

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

TransactionGetResult represents the result of a Get operation which was performed.

func (*TransactionGetResult) Content added in v2.4.0

func (d *TransactionGetResult) Content(valuePtr interface{}) error

Content provides access to the documents contents.

type TransactionHooks added in v2.4.0

type TransactionHooks interface {
	BeforeATRCommit(ctx TransactionAttemptContext) error
	AfterATRCommit(ctx TransactionAttemptContext) error
	BeforeDocCommitted(ctx TransactionAttemptContext, docID string) error
	BeforeRemovingDocDuringStagedInsert(ctx TransactionAttemptContext, docID string) error
	BeforeRollbackDeleteInserted(ctx TransactionAttemptContext, docID string) error
	AfterDocCommittedBeforeSavingCAS(ctx TransactionAttemptContext, docID string) error
	AfterDocCommitted(ctx TransactionAttemptContext, docID string) error
	BeforeStagedInsert(ctx TransactionAttemptContext, docID string) error
	BeforeStagedRemove(ctx TransactionAttemptContext, docID string) error
	BeforeStagedReplace(ctx TransactionAttemptContext, docID string) error
	BeforeDocRemoved(ctx TransactionAttemptContext, docID string) error
	BeforeDocRolledBack(ctx TransactionAttemptContext, docID string) error
	AfterDocRemovedPreRetry(ctx TransactionAttemptContext, docID string) error
	AfterDocRemovedPostRetry(ctx TransactionAttemptContext, docID string) error
	AfterGetComplete(ctx TransactionAttemptContext, docID string) error
	AfterStagedReplaceComplete(ctx TransactionAttemptContext, docID string) error
	AfterStagedRemoveComplete(ctx TransactionAttemptContext, docID string) error
	AfterStagedInsertComplete(ctx TransactionAttemptContext, docID string) error
	AfterRollbackReplaceOrRemove(ctx TransactionAttemptContext, docID string) error
	AfterRollbackDeleteInserted(ctx TransactionAttemptContext, docID string) error
	BeforeCheckATREntryForBlockingDoc(ctx TransactionAttemptContext, docID string) error
	BeforeDocGet(ctx TransactionAttemptContext, docID string) error
	BeforeGetDocInExistsDuringStagedInsert(ctx TransactionAttemptContext, docID string) error
	BeforeRemoveStagedInsert(ctx TransactionAttemptContext, docID string) error
	AfterRemoveStagedInsert(ctx TransactionAttemptContext, docID string) error
	AfterDocsCommitted(ctx TransactionAttemptContext) error
	AfterDocsRemoved(ctx TransactionAttemptContext) error
	AfterATRPending(ctx TransactionAttemptContext) error
	BeforeATRPending(ctx TransactionAttemptContext) error
	BeforeATRComplete(ctx TransactionAttemptContext) error
	BeforeATRRolledBack(ctx TransactionAttemptContext) error
	AfterATRComplete(ctx TransactionAttemptContext) error
	BeforeATRAborted(ctx TransactionAttemptContext) error
	AfterATRAborted(ctx TransactionAttemptContext) error
	AfterATRRolledBack(ctx TransactionAttemptContext) error
	BeforeATRCommitAmbiguityResolution(ctx TransactionAttemptContext) error
	RandomATRIDForVbucket(ctx TransactionAttemptContext) (string, error)
	HasExpiredClientSideHook(ctx TransactionAttemptContext, stage string, vbID string) (bool, error)
	BeforeQuery(ctx TransactionAttemptContext, statement string) error
	AfterQuery(ctx TransactionAttemptContext, statement string) error
}

TransactionHooks provides a number of internal hooks used for testing. Internal: This should never be used and is not supported.

type TransactionKeyspace added in v2.4.0

type TransactionKeyspace struct {
	BucketName     string
	ScopeName      string
	CollectionName string
}

TransactionKeyspace specifies a specific location where ATR entries should be placed when performing transactions.

type TransactionLogItem added in v2.5.2

type TransactionLogItem struct {
	Level LogLevel
	// contains filtered or unexported fields
}

TransactionLogItem represents an entry in the transaction in memory logging.

func (TransactionLogItem) String added in v2.5.2

func (item TransactionLogItem) String() string

type TransactionLogger added in v2.5.2

type TransactionLogger interface {
	Logs() []TransactionLogItem
}

TransactionLogger is the logger used for logging in transactions.

type TransactionOperationFailedError added in v2.4.0

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

TransactionOperationFailedError is used when a transaction operation fails. Internal: This should never be used and is not supported.

func (TransactionOperationFailedError) Error added in v2.4.0

func (TransactionOperationFailedError) InternalUnwrap added in v2.5.1

func (tfe TransactionOperationFailedError) InternalUnwrap() error

InternalUnwrap returns the underlying error for this error.

func (TransactionOperationFailedError) Retry added in v2.4.0

Retry signals whether a new transactionAttempt should be made at rollback.

func (TransactionOperationFailedError) Rollback added in v2.4.0

func (tfe TransactionOperationFailedError) Rollback() bool

Rollback signals whether the transactionAttempt should be auto-rolled back.

func (TransactionOperationFailedError) ToRaise added in v2.4.0

ToRaise signals which error type should be raised to the application.

type TransactionOptions added in v2.4.0

type TransactionOptions struct {
	// DurabilityLevel specifies the durability level that should be used
	// for all write operations performed by this transaction.
	DurabilityLevel DurabilityLevel

	// Timeout sets the maximum time that this transaction can run for, before expiring.
	Timeout time.Duration

	// MetadataCollection specifies a specific Collection to place meta-data.
	MetadataCollection *Collection

	// Internal specifies a set of options for internal use.
	// Internal: This should never be used and is not supported.
	Internal struct {
		Hooks TransactionHooks
	}
}

TransactionOptions specifies options which can be overridden on a per transaction basis.

type TransactionQueryOptions added in v2.4.0

type TransactionQueryOptions struct {
	ScanConsistency QueryScanConsistency
	Profile         QueryProfileMode

	// ScanCap is the maximum buffered channel size between the indexer connectionManager and the query service for index scans.
	ScanCap uint32

	// PipelineBatch controls the number of items execution operators can batch for Fetch from the KV.
	PipelineBatch uint32

	// PipelineCap controls the maximum number of items each execution operator can buffer between various operators.
	PipelineCap uint32

	// ScanWait is how long the indexer is allowed to wait until it can satisfy ScanConsistency/ConsistentWith criteria.
	ScanWait time.Duration
	Readonly bool

	// ClientContextID provides a unique ID for this query which can be used matching up requests between connectionManager and
	// server. If not provided will be assigned a uuid value.
	ClientContextID      string
	PositionalParameters []interface{}
	NamedParameters      map[string]interface{}

	// FlexIndex tells the query engine to use a flex index (utilizing the search service).
	FlexIndex bool

	// Raw provides a way to provide extra parameters in the request body for the query.
	Raw map[string]interface{}

	Prepared bool

	Scope *Scope
}

TransactionQueryOptions specifies the set of options available when running queries as a part of a transaction. This is a subset of QueryOptions.

type TransactionQueryResult added in v2.4.0

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

TransactionQueryResult allows access to the results of a query.

func (*TransactionQueryResult) MetaData added in v2.4.0

func (r *TransactionQueryResult) MetaData() (*QueryMetaData, error)

MetaData returns any meta-data that was available from this query. Note that the meta-data will only be available once the object has been closed (either implicitly or explicitly).

func (*TransactionQueryResult) Next added in v2.4.0

func (r *TransactionQueryResult) Next() bool

Next assigns the next result from the results into the value pointer, returning whether the read was successful.

func (*TransactionQueryResult) One added in v2.4.0

func (r *TransactionQueryResult) One(valuePtr interface{}) error

One assigns the first value from the results into the value pointer.

func (*TransactionQueryResult) Row added in v2.4.0

func (r *TransactionQueryResult) Row(valuePtr interface{}) error

Row returns the contents of the current row

type TransactionResult added in v2.4.0

type TransactionResult struct {
	// TransactionID represents the UUID assigned to this transaction
	TransactionID string

	// UnstagingComplete indicates whether the transaction was succesfully
	// unstaged, or if a later cleanup job will be responsible.
	UnstagingComplete bool

	// Logs returns the set of logs that were created during this transaction.
	// UNCOMMITTED: This API may change in the future.
	Logs []TransactionLogItem
}

TransactionResult represents the result of a transaction which was executed.

type Transactions added in v2.4.0

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

Transactions can be used to perform transactions.

func (*Transactions) Internal added in v2.4.0

func (t *Transactions) Internal() *TransactionsInternal

Internal returns an TransactionsInternal object which can be used for specialized internal use cases.

func (*Transactions) Run added in v2.4.0

func (t *Transactions) Run(logicFn AttemptFunc, perConfig *TransactionOptions) (*TransactionResult, error)

Run runs a lambda to perform a number of operations as part of a singular transaction.

type TransactionsBucketProviderFn added in v2.5.3

type TransactionsBucketProviderFn func(bucket string) (*Bucket, string, error)

TransactionsBucketProviderFn is a function used to provide a bucket for a particular bucket by name. Internal: This should never be used and is not supported.

type TransactionsCleaner added in v2.4.0

type TransactionsCleaner interface {
	AddRequest(req *TransactionCleanupRequest) bool
	PopRequest() *TransactionCleanupRequest
	ForceCleanupQueue() []TransactionCleanupAttempt
	QueueLength() int32
	CleanupAttempt(bucket *Bucket, isRegular bool, req *TransactionCleanupRequest) TransactionCleanupAttempt
	Close()
}

TransactionsCleaner is responsible for performing cleanup of completed transactions. Internal: This should never be used and is not supported.

func NewTransactionsCleaner added in v2.4.0

func NewTransactionsCleaner(bucketProvider TransactionsBucketProviderFn, config *TransactionsConfig) TransactionsCleaner

NewTransactionsCleaner returns a TransactionsCleaner implementation. Internal: This should never be used and is not supported.

type TransactionsCleanupConfig added in v2.4.0

type TransactionsCleanupConfig struct {
	// CleanupWindow specifies how often to the cleanup process runs
	// attempting to garbage collection transactions that have failed but
	// were not cleaned up by the previous client.
	CleanupWindow time.Duration

	// DisableClientAttemptCleanup controls where any transaction attempts made
	// by this client are automatically removed.
	DisableClientAttemptCleanup bool

	// DisableLostAttemptCleanup controls where a background process is created
	// to cleanup any ‘lost’ transaction attempts.
	DisableLostAttemptCleanup bool

	// CleanupQueueSize controls the maximum queue size for the cleanup thread.
	CleanupQueueSize uint32

	// CleanupCollections is a set of extra collections that should be monitored
	// by the cleanup thread.
	CleanupCollections []TransactionKeyspace
}

TransactionsCleanupConfig specifies various tunable options related to transactions cleanup.

type TransactionsClientRecordDetails added in v2.4.0

type TransactionsClientRecordDetails struct {
	NumActiveClients     int
	IndexOfThisClient    int
	ClientIsNew          bool
	ExpiredClientIDs     []string
	NumExistingClients   int
	NumExpiredClients    int
	OverrideEnabled      bool
	OverrideActive       bool
	OverrideExpiresCas   int64
	CasNowNanos          int64
	AtrsHandledByClient  []string
	CheckAtrEveryNMillis int
	ClientUUID           string
}

TransactionsClientRecordDetails is the result of processing a client record. Internal: This should never be used and is not supported.

type TransactionsConfig added in v2.4.0

type TransactionsConfig struct {
	// MetadataCollection specifies a specific location to place meta-data.
	MetadataCollection *TransactionKeyspace

	// ExpirationTimout sets the maximum time that transactions created
	// by this Transactions object can run for, before expiring.
	Timeout time.Duration

	// DurabilityLevel specifies the durability level that should be used
	// for all write operations performed by this Transactions object.
	DurabilityLevel DurabilityLevel

	// QueryConfig specifies any query configuration to use in transactions.
	QueryConfig TransactionsQueryConfig

	// CleanupConfig specifies cleanup configuration to use in transactions.
	CleanupConfig TransactionsCleanupConfig

	// Internal specifies a set of options for internal use.
	// Internal: This should never be used and is not supported.
	Internal struct {
		Hooks             TransactionHooks
		CleanupHooks      TransactionCleanupHooks
		ClientRecordHooks TransactionClientRecordHooks
		NumATRs           int
	}
}

TransactionsConfig specifies various tunable options related to transactions.

type TransactionsForwardCompatibilityEntry added in v2.4.0

type TransactionsForwardCompatibilityEntry struct {
	ProtocolVersion   string `json:"p,omitempty"`
	ProtocolExtension string `json:"e,omitempty"`
	Behaviour         string `json:"b,omitempty"`
	RetryInterval     int    `json:"ra,omitempty"`
}

TransactionsForwardCompatibilityEntry represents a forward compatibility entry. Internal: This should never be used and is not supported.

type TransactionsInternal added in v2.4.0

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

TransactionsInternal exposes internal methods that are useful for testing and/or other forms of internal use.

func (*TransactionsInternal) CleanupLocations added in v2.5.0

func (t *TransactionsInternal) CleanupLocations() []gocbcore.TransactionLostATRLocation

CleanupLocations returns the set of locations currently being watched by the lost transactions process.

func (*TransactionsInternal) CleanupQueueLength added in v2.4.0

func (t *TransactionsInternal) CleanupQueueLength() int32

CleanupQueueLength returns the current length of the client cleanup queue.

func (*TransactionsInternal) ClientCleanupEnabled added in v2.4.0

func (t *TransactionsInternal) ClientCleanupEnabled() bool

ClientCleanupEnabled returns whether the client cleanup process is enabled.

func (*TransactionsInternal) ForceCleanupQueue added in v2.4.0

func (t *TransactionsInternal) ForceCleanupQueue() []TransactionCleanupAttempt

ForceCleanupQueue forces the transactions client cleanup queue to drain without waiting for expirations.

type TransactionsLostCleanupKeyspaceProviderFn added in v2.5.3

type TransactionsLostCleanupKeyspaceProviderFn func() ([]TransactionKeyspace, error)

type TransactionsProcessATRStats added in v2.4.0

type TransactionsProcessATRStats struct {
	NumEntries        int
	NumEntriesExpired int
}

TransactionsProcessATRStats is the stats recorded when running a ProcessATR request. Internal: This should never be used and is not supported.

type TransactionsQueryConfig added in v2.4.0

type TransactionsQueryConfig struct {
	ScanConsistency QueryScanConsistency
}

TransactionsQueryConfig specifies various tunable query options related to transactions.

type Transcoder

type Transcoder interface {
	// Decodes retrieved bytes into a Go type.
	Decode([]byte, uint32, interface{}) error

	// Encodes a Go type into bytes for storage.
	Encode(interface{}) ([]byte, uint32, error)
}

Transcoder provides an interface for transforming Go values to and from raw bytes for storage and retreival from Couchbase data storage.

type UndeployEventingFunctionOptions added in v2.3.2

type UndeployEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UndeployEventingFunctionOptions are the options available when using the UndeployFunction operation.

type UnfreezePlanSearchIndexOptions

type UnfreezePlanSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UnfreezePlanSearchIndexOptions is the set of options available to the search index UnfreezePlan operation.

type UnlockOptions

type UnlockOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

UnlockOptions are the options available to the GetAndLock operation.

type UpdateBucketOptions

type UpdateBucketOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UpdateBucketOptions is the set of options available to the bucket manager UpdateBucket operation.

type UpsertDesignDocumentOptions

type UpsertDesignDocumentOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UpsertDesignDocumentOptions is the set of options available to the ViewIndexManager UpsertDesignDocument operation.

type UpsertEventingFunctionOptions added in v2.3.2

type UpsertEventingFunctionOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UpsertEventingFunctionOptions are the options available when using the UpsertFunction operation.

type UpsertGroupOptions

type UpsertGroupOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UpsertGroupOptions is the set of options available to the group manager Upsert operation.

type UpsertOp

type UpsertOp struct {
	ID     string
	Value  interface{}
	Expiry time.Duration
	Cas    Cas
	Result *MutationResult
	Err    error
	// contains filtered or unexported fields
}

UpsertOp represents a type of `BulkOp` used for Upsert operations. See BulkOp. UNCOMMITTED: This API may change in the future.

type UpsertOptions

type UpsertOptions struct {
	Expiry          time.Duration
	PersistTo       uint
	ReplicateTo     uint
	DurabilityLevel DurabilityLevel
	Transcoder      Transcoder
	Timeout         time.Duration
	RetryStrategy   RetryStrategy
	ParentSpan      RequestSpan
	PreserveExpiry  bool

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

UpsertOptions are options that can be applied to an Upsert operation.

type UpsertSearchIndexOptions

type UpsertSearchIndexOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UpsertSearchIndexOptions is the set of options available to the search index manager UpsertIndex operation.

type UpsertSpecOptions

type UpsertSpecOptions struct {
	CreatePath bool
	IsXattr    bool
}

UpsertSpecOptions are the options available to subdocument Upsert operations.

type UpsertUserOptions

type UpsertUserOptions struct {
	Timeout       time.Duration
	RetryStrategy RetryStrategy

	DomainName string
	ParentSpan RequestSpan

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

UpsertUserOptions is the set of options available to the user manager Upsert operation.

type User

type User struct {
	Username    string
	DisplayName string
	// Roles are the roles assigned to the user that are of type "user".
	Roles    []Role
	Groups   []string
	Password string
}

User represents a user which was retrieved from the server.

type UserAndMetadata

type UserAndMetadata struct {
	User

	Domain AuthDomain
	// EffectiveRoles are all of the user's roles and the origins.
	EffectiveRoles  []RoleAndOrigins
	ExternalGroups  []string
	PasswordChanged time.Time
}

UserAndMetadata represents a user and user meta-data from the server.

type UserManager

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

UserManager provides methods for performing Couchbase user management.

func (*UserManager) ChangePassword added in v2.5.1

func (um *UserManager) ChangePassword(newPassword string, opts *ChangePasswordOptions) error

ChangePassword changes the password for the currently authenticated user. *Note*: Usage of this function will effectively invalidate the SDK instance and further requests will fail due to authentication errors. After using this function the SDK must be reinitialized. UNCOMMITTED: This API may change in the future.

func (*UserManager) DropGroup

func (um *UserManager) DropGroup(groupName string, opts *DropGroupOptions) error

DropGroup removes a group from the server.

func (*UserManager) DropUser

func (um *UserManager) DropUser(name string, opts *DropUserOptions) error

DropUser removes a built-in RBAC user on the cluster.

func (*UserManager) GetAllGroups

func (um *UserManager) GetAllGroups(opts *GetAllGroupsOptions) ([]Group, error)

GetAllGroups fetches all groups from the server.

func (*UserManager) GetAllUsers

func (um *UserManager) GetAllUsers(opts *GetAllUsersOptions) ([]UserAndMetadata, error)

GetAllUsers returns a list of all the users from the cluster.

func (*UserManager) GetGroup

func (um *UserManager) GetGroup(groupName string, opts *GetGroupOptions) (*Group, error)

GetGroup fetches a single group from the server.

func (*UserManager) GetRoles

func (um *UserManager) GetRoles(opts *GetRolesOptions) ([]RoleAndDescription, error)

GetRoles lists the roles supported by the cluster.

func (*UserManager) GetUser

func (um *UserManager) GetUser(name string, opts *GetUserOptions) (*UserAndMetadata, error)

GetUser returns the data for a particular user

func (*UserManager) UpsertGroup

func (um *UserManager) UpsertGroup(group Group, opts *UpsertGroupOptions) error

UpsertGroup creates, or updates, a group on the server.

func (*UserManager) UpsertUser

func (um *UserManager) UpsertUser(user User, opts *UpsertUserOptions) error

UpsertUser updates a built-in RBAC user on the cluster.

type UserPassPair

type UserPassPair gocbcore.UserPassPair

UserPassPair represents a username and password pair. VOLATILE: This API is subject to change at any time.

type ValueRecorder added in v2.3.0

type ValueRecorder interface {
	RecordValue(val uint64)
}

ValueRecorder is used for grouping synchronous count metrics.

type View

type View struct {
	Map    string
	Reduce string
}

View represents a Couchbase view within a design document.

type ViewError

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

ViewError is the error type of all view query errors. UNCOMMITTED: This API may change in the future.

func (ViewError) Error

func (e ViewError) Error() string

Error returns the string representation of this error.

func (ViewError) MarshalJSON added in v2.2.1

func (e ViewError) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface.

func (ViewError) Unwrap

func (e ViewError) Unwrap() error

Unwrap returns the underlying cause for this error.

type ViewErrorDesc

type ViewErrorDesc struct {
	SourceNode string
	Message    string
}

ViewErrorDesc represents a specific error returned from the views service.

type ViewErrorMode

type ViewErrorMode uint

ViewErrorMode pecifies the behaviour of the query engine should an error occur during the gathering of view index results which would result in only partial results being available.

const (
	// ViewErrorModeContinue indicates to continue gathering results on error.
	ViewErrorModeContinue ViewErrorMode = iota + 1

	// ViewErrorModeStop indicates to stop gathering results on error
	ViewErrorModeStop
)

type ViewIndexManager

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

ViewIndexManager provides methods for performing View management.

func (*ViewIndexManager) DropDesignDocument

func (vm *ViewIndexManager) DropDesignDocument(name string, namespace DesignDocumentNamespace, opts *DropDesignDocumentOptions) error

DropDesignDocument will remove a design document from the given bucket.

func (*ViewIndexManager) GetAllDesignDocuments

func (vm *ViewIndexManager) GetAllDesignDocuments(namespace DesignDocumentNamespace, opts *GetAllDesignDocumentsOptions) ([]DesignDocument, error)

GetAllDesignDocuments will retrieve all design documents for the given bucket.

func (*ViewIndexManager) GetDesignDocument

func (vm *ViewIndexManager) GetDesignDocument(name string, namespace DesignDocumentNamespace, opts *GetDesignDocumentOptions) (*DesignDocument, error)

GetDesignDocument retrieves a single design document for the given bucket.

func (*ViewIndexManager) PublishDesignDocument

func (vm *ViewIndexManager) PublishDesignDocument(name string, opts *PublishDesignDocumentOptions) error

PublishDesignDocument publishes a design document to the given bucket.

func (*ViewIndexManager) UpsertDesignDocument

func (vm *ViewIndexManager) UpsertDesignDocument(ddoc DesignDocument, namespace DesignDocumentNamespace, opts *UpsertDesignDocumentOptions) error

UpsertDesignDocument will insert a design document to the given bucket, or update an existing design document with the same name.

type ViewMetaData

type ViewMetaData struct {
	TotalRows uint64
	Debug     interface{}
}

ViewMetaData provides access to the meta-data properties of a view query result.

type ViewOptions

type ViewOptions struct {
	ScanConsistency ViewScanConsistency
	Skip            uint32
	Limit           uint32
	Order           ViewOrdering
	Reduce          bool
	Group           bool
	GroupLevel      uint32
	Key             interface{}
	Keys            []interface{}
	StartKey        interface{}
	EndKey          interface{}
	InclusiveEnd    bool
	StartKeyDocID   string
	EndKeyDocID     string
	OnError         ViewErrorMode
	Debug           bool
	ParentSpan      RequestSpan

	// Raw provides a way to provide extra parameters in the request body for the query.
	Raw map[string]string

	Namespace DesignDocumentNamespace

	Timeout       time.Duration
	RetryStrategy RetryStrategy

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context

	// Internal: This should never be used and is not supported.
	Internal struct {
		User string
	}
}

ViewOptions represents the options available when executing view query.

type ViewOrdering

type ViewOrdering uint

ViewOrdering specifies the ordering for the view queries results.

const (
	// ViewOrderingAscending indicates the query results should be sorted from lowest to highest.
	ViewOrderingAscending ViewOrdering = iota + 1
	// ViewOrderingDescending indicates the query results should be sorted from highest to lowest.
	ViewOrderingDescending
)

type ViewResult

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

ViewResult implements an iterator interface which can be used to iterate over the rows of the query results.

func (*ViewResult) Close

func (r *ViewResult) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*ViewResult) Err

func (r *ViewResult) Err() error

Err returns any errors that have occurred on the stream

func (*ViewResult) MetaData

func (r *ViewResult) MetaData() (*ViewMetaData, error)

MetaData returns any meta-data that was available from this query. Note that the meta-data will only be available once the object has been closed (either implicitly or explicitly).

func (*ViewResult) Next

func (r *ViewResult) Next() bool

Next assigns the next result from the results into the value pointer, returning whether the read was successful.

func (*ViewResult) Raw added in v2.2.0

func (r *ViewResult) Raw() *ViewResultRaw

Raw returns a ViewResultRaw which can be used to access the raw byte data from view queries. Calling this function invalidates the underlying ViewResult which will no longer be able to be used. VOLATILE: This API is subject to change at any time.

func (*ViewResult) Row

func (r *ViewResult) Row() ViewRow

Row returns the contents of the current row.

type ViewResultRaw added in v2.2.0

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

ViewResultRaw provides raw access to views data. VOLATILE: This API is subject to change at any time.

func (*ViewResultRaw) Close added in v2.2.0

func (vrr *ViewResultRaw) Close() error

Close marks the results as closed, returning any errors that occurred during reading the results.

func (*ViewResultRaw) Err added in v2.2.0

func (vrr *ViewResultRaw) Err() error

Err returns any errors that have occurred on the stream

func (*ViewResultRaw) MetaData added in v2.2.0

func (vrr *ViewResultRaw) MetaData() ([]byte, error)

MetaData returns any meta-data that was available from this query as bytes.

func (*ViewResultRaw) NextBytes added in v2.2.0

func (vrr *ViewResultRaw) NextBytes() []byte

NextBytes returns the next row as bytes.

type ViewRow

type ViewRow struct {
	ID string
	// contains filtered or unexported fields
}

ViewRow represents a single row returned from a view query.

func (*ViewRow) Key

func (vr *ViewRow) Key(valuePtr interface{}) error

Key returns the key associated with this view row.

func (*ViewRow) Value

func (vr *ViewRow) Value(valuePtr interface{}) error

Value returns the value associated with this view row.

type ViewScanConsistency

type ViewScanConsistency uint

ViewScanConsistency specifies the consistency required for a view query.

const (
	// ViewScanConsistencyNotBounded indicates that no special behaviour should be used.
	ViewScanConsistencyNotBounded ViewScanConsistency = iota + 1
	// ViewScanConsistencyRequestPlus indicates to update the index before querying it.
	ViewScanConsistencyRequestPlus
	// ViewScanConsistencyUpdateAfter indicates to update the index asynchronously after querying.
	ViewScanConsistencyUpdateAfter
)

type WaitUntilReadyOptions added in v2.1.0

type WaitUntilReadyOptions struct {
	DesiredState ClusterState
	ServiceTypes []ServiceType

	// Using a deadlined Context with WaitUntilReady will cause the shorter of the provided timeout and context deadline
	// to cause cancellation.
	Context context.Context

	// VOLATILE: This API is subject to change at any time.
	RetryStrategy RetryStrategy
}

WaitUntilReadyOptions is the set of options available to the WaitUntilReady operations.

type WatchQueryIndexOptions

type WatchQueryIndexOptions struct {
	WatchPrimary bool

	RetryStrategy RetryStrategy
	ParentSpan    RequestSpan

	ScopeName      string
	CollectionName string

	// Using a deadlined Context alongside a Timeout will cause the shorter of the two to cause cancellation, this
	// also applies to global level timeouts.
	// UNCOMMITTED: This API may change in the future.
	Context context.Context
}

WatchQueryIndexOptions is the set of options available to the query indexes Watch operation.

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.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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