gocbcore

package
v0.0.0-...-711f10a Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2017 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqMagic = CommandMagic(0x80)
	ResMagic = CommandMagic(0x81)
)
View Source
const (
	CmdGet                = CommandCode(0x00)
	CmdSet                = CommandCode(0x01)
	CmdAdd                = CommandCode(0x02)
	CmdReplace            = CommandCode(0x03)
	CmdDelete             = CommandCode(0x04)
	CmdIncrement          = CommandCode(0x05)
	CmdDecrement          = CommandCode(0x06)
	CmdAppend             = CommandCode(0x0e)
	CmdPrepend            = CommandCode(0x0f)
	CmdStat               = CommandCode(0x10)
	CmdTouch              = CommandCode(0x1c)
	CmdGAT                = CommandCode(0x1d)
	CmdHello              = CommandCode(0x1f)
	CmdSASLListMechs      = CommandCode(0x20)
	CmdSASLAuth           = CommandCode(0x21)
	CmdSASLStep           = CommandCode(0x22)
	CmdDcpOpenConnection  = CommandCode(0x50)
	CmdDcpAddStream       = CommandCode(0x51)
	CmdDcpCloseStream     = CommandCode(0x52)
	CmdDcpStreamReq       = CommandCode(0x53)
	CmdDcpGetFailoverLog  = CommandCode(0x54)
	CmdDcpStreamEnd       = CommandCode(0x55)
	CmdDcpSnapshotMarker  = CommandCode(0x56)
	CmdDcpMutation        = CommandCode(0x57)
	CmdDcpDeletion        = CommandCode(0x58)
	CmdDcpExpiration      = CommandCode(0x59)
	CmdDcpFlush           = CommandCode(0x5a)
	CmdDcpSetVbucketState = CommandCode(0x5b)
	CmdDcpNoop            = CommandCode(0x5c)
	CmdDcpBufferAck       = CommandCode(0x5d)
	CmdDcpControl         = CommandCode(0x5e)
	CmdGetReplica         = CommandCode(0x83)
	CmdSelectBucket       = CommandCode(0x89)
	CmdObserveSeqNo       = CommandCode(0x91)
	CmdObserve            = CommandCode(0x92)
	CmdGetLocked          = CommandCode(0x94)
	CmdUnlockKey          = CommandCode(0x95)
	CmdGetLastCheckpoint  = CommandCode(0x97)
	CmdSetMeta            = CommandCode(0xa2)
	CmdDetMeta            = CommandCode(0xa8)
	CmdGetClusterConfig   = CommandCode(0xb5)
	CmdGetRandom          = CommandCode(0xb6)
)
View Source
const (
	FeatureDatatype = HelloFeature(0x01)
	FeatureSeqNo    = HelloFeature(0x04)
)
View Source
const (
	StatusSuccess        = StatusCode(0x00)
	StatusKeyNotFound    = StatusCode(0x01)
	StatusKeyExists      = StatusCode(0x02)
	StatusTooBig         = StatusCode(0x03)
	StatusInvalidArgs    = StatusCode(0x04)
	StatusNotStored      = StatusCode(0x05)
	StatusBadDelta       = StatusCode(0x06)
	StatusNotMyVBucket   = StatusCode(0x07)
	StatusNoBucket       = StatusCode(0x08)
	StatusAuthStale      = StatusCode(0x1f)
	StatusAuthError      = StatusCode(0x20)
	StatusAuthContinue   = StatusCode(0x21)
	StatusRangeError     = StatusCode(0x22)
	StatusRollback       = StatusCode(0x23)
	StatusAccessError    = StatusCode(0x24)
	StatusNotInitialized = StatusCode(0x25)
	StatusUnknownCommand = StatusCode(0x81)
	StatusOutOfMemory    = StatusCode(0x82)
	StatusNotSupported   = StatusCode(0x83)
	StatusInternalError  = StatusCode(0x84)
	StatusBusy           = StatusCode(0x85)
	StatusTmpFail        = StatusCode(0x86)
)
View Source
const (
	KeyStateNotPersisted = KeyState(0x00)
	KeyStatePersisted    = KeyState(0x01)
	KeyStateNotFound     = KeyState(0x80)
	KeyStateDeleted      = KeyState(0x81)
)
View Source
const (
	StreamEndOK           = StreamEndStatus(0x00)
	StreamEndClosed       = StreamEndStatus(0x01)
	StreamEndStateChanged = StreamEndStatus(0x02)
	StreamEndDisconnected = StreamEndStatus(0x03)
	StreamEndTooSlow      = StreamEndStatus(0x04)
)

Variables

This section is empty.

Functions

func AcquireTimer

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

func CreateMemdPipeline

func CreateMemdPipeline(address string) *memdPipeline

func DialMemdConn

func DialMemdConn(address string, tlsConfig *tls.Config, deadline time.Time) (*memdConn, error)

func ReleaseTimer

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

func SetLogger

func SetLogger(logger Logger)

Types

type Agent

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

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

func CreateAgent

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

func CreateDcpAgent

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

func (*Agent) Add

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

func (*Agent) Append

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

func (*Agent) CapiEps

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

func (*Agent) Close

func (agent *Agent) Close()

func (*Agent) CloseStream

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

func (*Agent) Decrement

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

func (*Agent) DeleteMeta

func (c *Agent) DeleteMeta(key, extra []byte, flags, expiry uint32, cas, revseqno uint64, cb RemoveCallback) (PendingOp, error)

func (*Agent) Get

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

func (*Agent) GetAndLock

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

func (*Agent) GetAndTouch

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

func (*Agent) GetFailoverLog

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

func (*Agent) GetLastCheckpoint

func (c *Agent) GetLastCheckpoint(vbId uint16, cb GetLastCheckpointCallback) (PendingOp, error)

func (*Agent) GetRandom

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

func (*Agent) GetReplica

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

func (*Agent) HttpClient

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

Returns a pre-configured HTTP Client for communicating with

Couchbase Server.  You must still specify authentication
information for any dispatched requests.

func (*Agent) Increment

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

func (*Agent) IsSecure

func (c *Agent) IsSecure() bool

func (*Agent) KeyToVbucket

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

func (*Agent) MgmtEps

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

func (*Agent) N1qlEps

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

func (*Agent) NumReplicas

func (c *Agent) NumReplicas() int

func (*Agent) NumVbuckets

func (c *Agent) NumVbuckets() int

func (*Agent) Observe

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

func (*Agent) ObserveSeqNo

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

func (*Agent) OpenStream

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

func (*Agent) Prepend

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

func (*Agent) Remove

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

func (*Agent) Replace

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

func (*Agent) ServerConnectTimeout

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

The timeout for each server connection, including all authentication steps.

func (*Agent) Set

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

func (*Agent) SetMeta

func (c *Agent) SetMeta(key, value, extra []byte, flags, expiry uint32, cas, revseqno uint64, cb StoreCallback) (PendingOp, error)

func (*Agent) SetServerConnectTimeout

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

func (*Agent) Touch

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

func (*Agent) Unlock

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

type AgentConfig

type AgentConfig struct {
	MemdAddrs         []string
	HttpAddrs         []string
	TlsConfig         *tls.Config
	BucketName        string
	Password          string
	AuthHandler       AuthFunc
	UseMutationTokens bool

	ConnectTimeout       time.Duration
	ServerConnectTimeout time.Duration
}

type AuthClient

type AuthClient interface {
	Address() string

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

type AuthErrorType

type AuthErrorType interface {
	AuthError() bool
}

type AuthFunc

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

type BadRouteHandler

type BadRouteHandler func(*memdPipeline, *memdQRequest, *memdResponse)

type Callback

type Callback func(*memdResponse, error)

type Cas

type Cas uint64

type CloseHandler

type CloseHandler func(*memdPipeline)

type CloseStreamCallback

type CloseStreamCallback func(error)

type CommandCode

type CommandCode uint8

CommandCode for memcached packets.

type CommandMagic

type CommandMagic uint8

type CounterCallback

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

type FailoverEntry

type FailoverEntry struct {
	VbUuid VbUuid
	SeqNo  SeqNo
}

type GetCallback

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

type GetFailoverLogCallback

type GetFailoverLogCallback func([]FailoverEntry, error)

type GetLastCheckpointCallback

type GetLastCheckpointCallback func(SeqNo, error)

type GetRandomCallback

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

type HelloFeature

type HelloFeature uint16

type KeyState

type KeyState uint8

type Logger

type Logger interface {
	Output(s string) error
}

func DefaultStdOutLogger

func DefaultStdOutLogger() Logger

type MutationToken

type MutationToken struct {
	VbUuid VbUuid
	SeqNo  SeqNo
}

type ObserveCallback

type ObserveCallback func(KeyState, Cas, error)

type ObserveSeqNoCallback

type ObserveSeqNoCallback func(SeqNo, SeqNo, error)

type OpenStreamCallback

type OpenStreamCallback func([]FailoverEntry, error)

type PendingOp

type PendingOp interface {
	Cancel() bool
}

type RemoveCallback

type RemoveCallback func(Cas, MutationToken, error)

type SeqNo

type SeqNo uint64

type SnapshotState

type SnapshotState uint32

func (SnapshotState) HasInMemory

func (s SnapshotState) HasInMemory() bool

func (SnapshotState) HasOnDisk

func (s SnapshotState) HasOnDisk() bool

type StatusCode

type StatusCode uint16

Status field for memcached response.

type StoreCallback

type StoreCallback func(Cas, MutationToken, error)

type StreamEndStatus

type StreamEndStatus uint32

type StreamObserver

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

type TouchCallback

type TouchCallback func(Cas, MutationToken, error)

type UnlockCallback

type UnlockCallback func(Cas, MutationToken, error)

type VbUuid

type VbUuid uint64

Jump to

Keyboard shortcuts

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