Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Go
branch: master

MB-14255: Avoid race condition between Refresh() and pool.Return

Refreshing a bucket will cause the connection pool to be recycled
so returning an old connection to the connection pool following
a refresh is incorrect.

Change-Id: I509b8920f9e63e67679673403f28dd00441c0fd9
Reviewed-on: http://review.couchbase.org/49955
Reviewed-by: Colm McHugh <colm@couchbase.com>
Reviewed-by: Gerald Sangudi <gerald@couchbase.com>
Tested-by: Manik Taneja <manik@couchbase.com>
latest commit 6c40717d92
@maniktaneja maniktaneja authored maniktaneja committed
Failed to load latest commit information.
cbdatasource cbdatasource: go fmt
examples MB-14421: Add some log messages to debug crash in UprCloseStream
populate CBD-1513: Rename all couchbaselabs Go projects to github.com/couchbase.
tools CBD-1513: Rename all couchbaselabs Go projects to github.com/couchbase.
util CBD-1513: Rename all couchbaselabs Go projects to github.com/couchbase.
.gitignore gitignore vim swap files.
.travis.yml Stupid travis and its old versionness.
LICENSE Added a license
README.markdown CBD-1513: Rename all couchbaselabs Go projects to github.com/couchbase.
client.go MB-14255: Avoid race condition between Refresh() and pool.Return
client_test.go Handle WriteOptions masks when stringing
conn_pool.go implemented more flexible auth support
conn_pool_test.go Update import paths for memcached client
ddocs.go MB-13738 & MB-13878 : Retry http requests due to network failure
pools.go Log details of non-healthy nodes in Bucket.HealthyNodes(). MB-13998.
pools_test.go Some testing on connection pool replacement/fetching
tap.go Refresh bucket on connection error
upr.go MB-14421: Add some log messages to debug crash in UprCloseStream
util.go doc/golint cleanup
util_test.go Use table for util tests
vbmap.go doc/golint cleanup
vbmap_test.go Atomically perform bucket refreshes
views.go Log details of non-healthy nodes in Bucket.HealthyNodes(). MB-13998.
views_test.go doc/golint cleanup

README.markdown

A smart client for couchbase in go

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"})
Something went wrong with that request. Please try again.