Documentation ¶
Index ¶
- Variables
- type Client
- func (client *Client) AddBuckets(topic string, reqTimestamps []*protobuf.TsVbuuid, ...) (*protobuf.TopicResponse, error)
- func (client *Client) AddInstances(topic string, instances []*protobuf.Instance) (*protobuf.TimestampResponse, error)
- func (client *Client) DelBuckets(topic string, buckets []string) error
- func (client *Client) DelInstances(topic string, uuids []uint64) error
- func (client *Client) GetFailoverLogs(pooln, bucketn string, vbnos []uint32) (*protobuf.FailoverLogResponse, error)
- func (client *Client) GetVbmap(pooln, bucketn string, kvaddrs []string) (*protobuf.VbmapResponse, error)
- func (client *Client) InitialRestartTimestamp(pooln, bucketn string) (*protobuf.TsVbuuid, error)
- func (client *Client) InitialTopicRequest(topic, pooln, endpointType string, instances []*protobuf.Instance) (*protobuf.TopicResponse, error)
- func (client *Client) MutationTopicRequest(topic, endpointType string, reqTimestamps []*protobuf.TsVbuuid, ...) (*protobuf.TopicResponse, error)
- func (client *Client) RepairEndpoints(topic string, endpoints []string) error
- func (client *Client) RestartVbuckets(topic string, restartTimestamps []*protobuf.TsVbuuid) (*protobuf.TopicResponse, error)
- func (client *Client) ShutdownTopic(topic string) error
- func (client *Client) ShutdownVbuckets(topic string, shutdownTimestamps []*protobuf.TsVbuuid) error
- func (client *Client) String() string
Constants ¶
This section is empty.
Variables ¶
var ErrorClusterInfo = errors.New("feed.clusterInfo")
ErrorClusterInfo
var ErrorDCPBucket = errors.New("feed.dcpBucket")
ErrorDCPBucket
var ErrorDCPConnection = errors.New("feed.dcpConnection")
ErrorDCPConnection
var ErrorDCPPool = errors.New("feed.dcpPool")
ErrorDCPPool
var ErrorFeeder = errors.New("feed.feeder")
ErrorFeeder
var ErrorInconsistentFeed = errors.New("feed.inconsistentFeed")
ErrorInconsistentFeed
var ErrorInvalidBucket = errors.New("feed.invalidBucket")
ErrorInvalidBucket
var ErrorInvalidKVaddrs = errors.New("feed.invalidKVaddrs")
ErrorInvalidKVaddrs
var ErrorInvalidVbucket = errors.New("feed.invalidVbucket")
ErrorInvalidVbucket
var ErrorInvalidVbucketBranch = errors.New("feed.invalidVbucketBranch")
ErrorInvalidVbucketBranch
var ErrorNotMyVbucket = errors.New("feed.notMyVbucket")
ErrorNotMyVbucket
var ErrorResponseTimeout = errors.New("feed.responseTimeout")
ErrorResponseTimeout is sent when projector does not recieve expected control message like StreamBegin (when stream is started) and StreamEnd (when stream is closed).
var ErrorStreamEnd = errors.New("feed.streamEnd")
ErrorStreamEnd
var ErrorStreamRequest = errors.New("feed.streamRequest")
ErrorStreamRequest
var ErrorTopicExist = errors.New("projector.topicExist")
ErrorTopicExist
var ErrorTopicMissing = errors.New("projector.topicMissing")
ErrorTopicMissing
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client connects with a projector's adminport to issues request and get back response.
func NewClient ¶
NewClient connect with projector identified by `adminport`.
- `retryInterval` is specified in milliseconds. if retryInterval is ZERO, API will not perform retry.
- if `maxRetries` is ZERO, will perform indefinite retry.
func (*Client) AddBuckets ¶
func (client *Client) AddBuckets( topic string, reqTimestamps []*protobuf.TsVbuuid, instances []*protobuf.Instance) (*protobuf.TopicResponse, error)
AddBuckets will add one or more buckets to an active-feed.
Idempotent API.
- return TopicResponse that contain current set of active-timestamps and rollback-timestamps reflected from projector, even in case of error.
- Since the API is idempotent, it can be called repeatedly until all requested vbuckets are started and returns SUCCESS to caller.
Possible errors returned,
- http errors for transport related failures.
- ErrorTopicMissing if feed is not started.
- ErrorInconsistentFeed for malformed feed request
- ErrorInvalidVbucketBranch for malformed vbuuid.
- ErrorFeeder if upstream connection has failures. upstream connection is closed for the bucket, the bucket needs to be newly added.
- ErrorNotMyVbucket due to rebalances and failures.
- ErrorStreamRequest if StreamRequest failed for some reason
- ErrorResponseTimeout if request is not completed within timeout.
- except of ErrorFeeder, projector feed will book-keep oustanding request for vbuckets and active vbuckets. Caller should observe mutation feed for StreamBegin and retry until all vbuckets are started.
- active-timestamps returned in TopicResponse response contain entries only for successfully started {bucket,vbuckets}.
- rollback-timestamp contains vbucket entries that need rollback.
func (*Client) AddInstances ¶
func (client *Client) AddInstances( topic string, instances []*protobuf.Instance) (*protobuf.TimestampResponse, error)
AddInstances will add one or more instances to one or more buckets. Idempotent API, provided ErrorInconsistentFeed is addressed.
Possible errors returned, - http errors for transport related failures. - ErrorTopicMissing if feed is not started. - ErrorInconsistentFeed for malformed feed request.
func (*Client) DelBuckets ¶
DelBuckets will delete one or more buckets, and all of its instances, from a feed. Idempotent API.
Possible errors returned, - http errors for transport related failures. - ErrorTopicMissing if feed is not started.
func (*Client) DelInstances ¶
DelInstances will delete one or more instances from one or more buckets. If the deleted instance is the last instance for bucket, then caller should have used DelBuckets() to delete the bucket. Projector does not encourage a bucket with ZERO instance. Idempotent API.
Possible errors returned, - http errors for transport related failures. - ErrorTopicMissing if feed is not started.
func (*Client) GetFailoverLogs ¶
func (client *Client) GetFailoverLogs( pooln, bucketn string, vbnos []uint32) (*protobuf.FailoverLogResponse, error)
GetFailoverLogs from projector, for a set vbuckets. - return http errors for transport related failures. - return couchbase SDK error if any.
func (*Client) GetVbmap ¶
func (client *Client) GetVbmap( pooln, bucketn string, kvaddrs []string) (*protobuf.VbmapResponse, error)
GetVbmap from projector, for a set of kvnodes. - return http errors for transport related failures. - return couchbase SDK error if any.
func (*Client) InitialRestartTimestamp ¶
InitialRestartTimestamp will compose the initial set of timestamp for a subset of vbuckets in `bucket`. - return http errors for transport related failures.
func (*Client) InitialTopicRequest ¶
func (client *Client) InitialTopicRequest( topic, pooln, endpointType string, instances []*protobuf.Instance) (*protobuf.TopicResponse, error)
InitialTopicRequest topic from a kvnode, for an initial set of instances. Initial topic will always start vbucket streams from seqno number ZERO using the latest-vbuuid.
Idempotent API.
- return TopicResponse that contain current set of active-timestamps and rollback-timestamps reflected from projector, even in case of error.
Possible errors returned,
- http errors for transport related failures.
- ErrorInvalidKVaddrs if projector unable to find colocated host.
- ErrorInconsistentFeed for malformed feed request.
- ErrorInvalidVbucketBranch for malformed vbuuid.
- ErrorFeeder if upstream connection has failures. upstream connection is closed for the bucket, the bucket needs to be newly added.
- ErrorNotMyVbucket due to rebalances and failures.
- ErrorStreamRequest if StreamRequest failed for some reason
- ErrorResponseTimeout if request is not completed within timeout.
- except of ErrorFeeder, projector feed will book-keep oustanding request for vbuckets and active vbuckets. Caller should observe mutation feed for StreamBegin and retry until all vbuckets are started.
- active-timestamps returned in TopicResponse contain entries only for successfully started {buckets,vbuckets}.
- rollback-timestamps contain vbucket entries that need rollback.
func (*Client) MutationTopicRequest ¶
func (client *Client) MutationTopicRequest( topic, endpointType string, reqTimestamps []*protobuf.TsVbuuid, instances []*protobuf.Instance) (*protobuf.TopicResponse, error)
MutationTopicRequest topic from a kvnode, with initial set of instances.
Idempotent API.
- return TopicResponse that contain current set of active-timestamps and rollback-timestamps reflected from projector, even in case of error.
- Since the API is idempotent, it can be called repeatedly until all requested vbuckets are started and returns SUCCESS to caller.
Possible errors returned,
- http errors for transport related failures.
- ErrorInvalidKVaddrs if projector unable to find colocated host.
- ErrorInconsistentFeed for malformed feed request.
- ErrorInvalidVbucketBranch for malformed vbuuid.
- ErrorFeeder if upstream connection has failures. upstream connection is closed for the bucket, the bucket needs to be newly added.
- ErrorNotMyVbucket due to rebalances and failures.
- ErrorStreamRequest if StreamRequest failed for some reason
- ErrorResponseTimeout if request is not completed within timeout.
- except of ErrorFeeder, projector feed will book-keep oustanding request for vbuckets and active vbuckets. Caller should observe mutation feed for StreamBegin and retry until all vbuckets are started.
- active-timestamps returned in TopicResponse response contain entries only for successfully started {bucket,vbuckets}.
- rollback-timestamp contains vbucket entries that need rollback.
func (*Client) RepairEndpoints ¶
RepairEndpoints will restart endpoints. Idempotent API.
- return http errors for transport related failures. - return ErrorTopicMissing if feed is not started.
func (*Client) RestartVbuckets ¶
func (client *Client) RestartVbuckets( topic string, restartTimestamps []*protobuf.TsVbuuid) (*protobuf.TopicResponse, error)
RestartVbuckets for one or more {bucket, vbuckets}. If a vbucket is already active or if there is an outstanding StreamRequset for a vbucket, then that vbucket is ignored.
Idempotent API.
- return TopicResponse that contain current set of active-timestamps and rollback-timestamps reflected from projector, even in case of error.
- Since the API is idempotent, it can be called repeatedly until all requested vbuckets are started and returns SUCCESS to caller.
Possible errors returned,
- http errors for transport related failures.
- ErrorTopicMissing if feed is not started.
- ErrorInvalidBucket if bucket is not added.
- ErrorInvalidVbucketBranch for malformed vbuuid.
- ErrorFeeder if upstream connection has failures. upstream connection is closed for the bucket, the bucket needs to be newly added.
- ErrorNotMyVbucket due to rebalances and failures.
- ErrorStreamRequest if StreamRequest failed for some reason
- ErrorStreamEnd if StreamEnd failed for some reason
- ErrorResponseTimeout if request is not completed within timeout.
- if vbucket is already active and to force restart a vbucket stream, use ShutdownVbuckets().
- except of ErrorFeeder, projector feed will book-keep oustanding request for vbuckets and active vbuckets. Caller should observe mutation feed for StreamBegin and retry until all vbuckets are started.
- active-timestamps returned in TopicResponse response contain entries only for successfully started {bucket,vbuckets}.
- rollback-timestamp contains vbucket entries that need rollback.
func (*Client) ShutdownTopic ¶
ShutdownTopic will stop the feed for topic. Idempotent API.
- return http errors for transport related failures. - return ErrorTopicMissing if feed is not started.
func (*Client) ShutdownVbuckets ¶
func (client *Client) ShutdownVbuckets( topic string, shutdownTimestamps []*protobuf.TsVbuuid) error
ShutdownVbuckets for one or more {bucket, vbuckets}.
Idempotent API
- return TopicResponse that contain current set of active-timestamps, after shutting down all vbuckets or partial set of vbuckets.
- Since the API is idempotent, it can be called repeatedly until all requested vbuckets have ended and returns SUCCESS to caller.
Possible errors returned,
- errors for transport related failures.
- ErrorTopicMissing if feed is not started.
- ErrorInvalidBucket if bucket is not added.
- ErrorInvalidVbucketBranch for malformed vbuuid.
- ErrorFeeder if upstream connection has failures. upstream connection is closed for the bucket, the bucket needs to be newly added.
- ErrorResponseTimeout if request is not completed within timeout.
- except of ErrorFeeder, projector feed will book-keep oustanding request for vbuckets and active vbuckets. Caller should observe mutation feed for StreamBegin and retry until all vbuckets are started.
- active-timestamps returned in TopicResponse response contain entries only for successfully started {bucket,vbuckets}.
- rollback-timestamp contains vbucket entries that need rollback.