modulepackage
0.1.1
Repository: https://github.com/couchbase/go-couchbase.git
Documentation: pkg.go.dev
# README
A smart client for couchbase in go
This is a unoffical version of a Couchbase Golang client. If you are looking for the Offical Couchbase Golang client please see [CB-go])[https://github.com/couchbaselabs/gocb].
This is an evolving package, but does provide a useful interface to a couchbase server including all of the pool/bucket discovery features, compatible key distribution with other clients, and vbucket motion awareness so application can continue to operate during rebalances.
It also supports view querying with source node randomization so you don't bang on all one node to do all the work.
Install
go get github.com/couchbase/go-couchbase
Example
c, err := couchbase.Connect("http://dev-couchbase.example.com:8091/")
if err != nil {
log.Fatalf("Error connecting: %v", err)
}
pool, err := c.GetPool("default")
if err != nil {
log.Fatalf("Error getting pool: %v", err)
}
bucket, err := pool.GetBucket("default")
if err != nil {
log.Fatalf("Error getting bucket: %v", err)
}
bucket.Set("someKey", 0, []string{"an", "example", "list"})
# Packages
Package cbdatasource streams data from a Couchbase cluster.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package trace provides a ring buffer utility to trace events.
Package couchbaseutil offers some convenience functions for apps that use couchbase.
# Functions
No description provided by the author
CleanupHost returns the hostname with the given suffix removed.
No description provided by the author
Connect to a couchbase cluster.
ConnectWithAuth connects to a couchbase cluster with the given authentication handler.
ConnectWithAuthAndGetBucket is a convenience function for getting a named bucket from a given URL and an auth callback.
ConnectWithAuthCreds connects to a couchbase cluster with the give authorization creds returned by cb_auth.
Turn off overflow connections.
No description provided by the author
Toggle asynchronous overflow closer.
FindCommonSuffix returns the longest common suffix from the given strings.
GetBucket is a convenience function for getting a named bucket from a URL.
Get SASL buckets.
No description provided by the author
No description provided by the author
Return true if error is KEY_EEXISTS.
Return true if error is KEY_ENOENT.
No description provided by the author
Return true if error suggests a bucket refresh is required.
Return true if a collection is not known.
Accepts a "host:port" string representing the KV TCP port and the pools nodeServices payload and returns a host:port string representing the KV TLS port on the same node as the KV TCP port.
No description provided by the author
NewPool creates a new pool of jobs.
No description provided by the author
ParseURL is a wrapper around url.Parse with some sanity-checking.
No description provided by the author
Allow applications to speciify the Poolsize and Overflow.
No description provided by the author
No description provided by the author
No description provided by the author
Allow TCP keepalive parameters to be set by the application.
Set viewUpdateDaemonOptions.
# Constants
No description provided by the author
No description provided by the author
AddOnly indicates an item should only be written if it doesn't exist, otherwise ErrKeyExists is returned.
Append indicates the given value should be appended to the existing value for the given key.
20 Mb.
No description provided by the author
arbitary number, may need to be tuned #FIXME.
Indexable causes the operation to block until it's availble via the index.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Persist causes the operation to block until the server confirms the item is persisted.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Raw specifies that the value is raw []byte or nil; don't JSON-encode it.
No description provided by the author
No description provided by the author
No description provided by the author
Return this as the error from an UpdateFunc to cancel the Update operation.
# Variables
AsynchronousCloser turns on asynchronous closing for overflow connections.
ClientOpCallback is called for each invocation of Do.
No description provided by the author
overflow connection closer cycle time.
ConnPoolAvailWaitTime is the amount of time to wait for an existing connection from the pool before considering the creation of a new one.
ConnPoolTimeout is notified whenever connections are acquired from a pool.
Default timeout for retrieving a connection from the pool.
No description provided by the author
No description provided by the author
Enable Collections.
Enable Data Type response.
Enable MutationToken.
Enable Xattr.
Error returned from Write with AddOnly flag, when key already exists in the bucket.
Returned from WaitForPersistence (or Write, if the Persistent or Indexable flag is used) if the value has been overwritten by another before being persisted.
Returned from WaitForPersistence (or Write, if the Persistent or Indexable flag is used) if the value hasn't been persisted by the timeout interval.
No description provided by the author
Use this client for reading from streams that should be open for an extended duration.
No description provided by the author
exponentail backOff result in over 30sec (25*13*0.1s).
Maximum number of times to retry a chunk of a bulk get on error.
HTTPClient to use for REST and view operations.
No description provided by the author
No description provided by the author
No description provided by the author
PoolOverflow is the number of overflow connections allowed in a pool.
PoolSize is the size of each connection pool (per host).
If this is set to a nonzero duration, Do() and ViewCustom() will log a warning if the call takes longer than that.
TCP KeepAlive enabled/disabled.
TCP keepalive interval in seconds.
Error raised when a connection can't be retrieved from a pool.
ViewCallback is called for each view invocation.
# Structs
Sample data: {"disabled":["12333", "22244"],"uid":"132492431","auditdEnabled":true, "disabledUsers":[{"name":"bill","domain":"local"},{"name":"bob","domain":"local"}], "logPath":"/Users/johanlarson/Library/Application Support/Couchbase/var/lib/couchbase/logs", "rotateInterval":86400,"rotateSize":20971520}.
No description provided by the author
Bucket is the primary entry point for most data operations.
No description provided by the author
No description provided by the author
No description provided by the author
A Client is the starting point for all services across all buckets in a Couchbase cluster.
No description provided by the author
DDoc is the document body of a design document specifying a view.
DDocsResult represents the result from listing the design documents.
No description provided by the author
UprFeed from a single connection.
No description provided by the author
No description provided by the author
Structures for parsing collections manifest.
No description provided by the author
Structures for storing collections information.
Mutation Token.
A Node is a computer in a cluster running the couchbase software.
No description provided by the author
NodeServices is all the bucket-independent services running on a node (given by Hostname).
No description provided by the author
No description provided by the author
pool of ObservePersist Jobs.
A Pool of nodes and buckets.
Pools represents the collection of pools as returned from the REST API.
PoolServices is all the bucket-independent services in a pool.
RestPool represents a single pool returned from the pools REST API.
No description provided by the author
Sample: {"role":"admin","name":"Admin","desc":"Can manage ALL cluster features including security.","ce":true} {"role":"query_select","bucket_name":"*","name":"Query Select","desc":"Can execute SELECT statement on bucket to retrieve data"}.
No description provided by the author
A TapFeed streams mutation events from a bucket.
A UprFeed streams mutation events from a bucket.
No description provided by the author
VBucketServerMap is the a mapping of vbuckets to nodes.
ViewDefinition represents a single view within a design document.
A ViewError is a node-specific error indicating a partial failure within a view result.
ViewResult holds the entire result set from a view request, including the rows and the errors.
ViewRow represents a single result from a view.
# Interfaces
AuthHandler is a callback that gets the auth username and password for the given bucket.
AuthHandler is a callback that gets the auth username and password for the given bucket and sasl for memcached.
GenericMcdAuthHandler is a kind of AuthHandler that performs special auth exchange (like non-standard auth, possibly followed by select-bucket).
HTTPAuthHandler is kind of AuthHandler that performs more general for outgoing http requests than is possible via simple GetCredentials() call (i.e.
MultiBucketAuthHandler is kind of AuthHandler that may perform different auth for different buckets.
# Type aliases
No description provided by the author
DocID is the document ID type for the startkey_docid parameter in views.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
An UpdateFunc is a callback function to update a document.
WriteOptions is the set of option flags availble for the Write method.
A WriteUpdateFunc is a callback function to update a document.