client

package
v0.0.0-...-d8c7374 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorClusterInfo = errors.New("feed.clusterInfo")

ErrorClusterInfo

View Source
var ErrorDCPBucket = errors.New("feed.dcpBucket")

ErrorDCPBucket

View Source
var ErrorDCPConnection = errors.New("feed.dcpConnection")

ErrorDCPConnection

View Source
var ErrorDCPPool = errors.New("feed.dcpPool")

ErrorDCPPool

View Source
var ErrorFeeder = errors.New("feed.feeder")

ErrorFeeder

View Source
var ErrorInconsistentFeed = errors.New("feed.inconsistentFeed")

ErrorInconsistentFeed

View Source
var ErrorInvalidBucket = errors.New("feed.invalidBucket")

ErrorInvalidBucket

View Source
var ErrorInvalidKVaddrs = errors.New("feed.invalidKVaddrs")

ErrorInvalidKVaddrs

View Source
var ErrorInvalidVbucket = errors.New("feed.invalidVbucket")

ErrorInvalidVbucket

View Source
var ErrorInvalidVbucketBranch = errors.New("feed.invalidVbucketBranch")

ErrorInvalidVbucketBranch

View Source
var ErrorNotMyVbucket = errors.New("feed.notMyVbucket")

ErrorNotMyVbucket

View Source
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).

View Source
var ErrorStreamEnd = errors.New("feed.streamEnd")

ErrorStreamEnd

View Source
var ErrorStreamRequest = errors.New("feed.streamRequest")

ErrorStreamRequest

View Source
var ErrorTopicExist = errors.New("projector.topicExist")

ErrorTopicExist

View Source
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

func NewClient(adminport string, maxvbs int, config c.Config) *Client

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

func (client *Client) DelBuckets(topic string, buckets []string) error

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

func (client *Client) DelInstances(topic string, uuids []uint64) error

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

func (client *Client) InitialRestartTimestamp(
	pooln, bucketn string) (*protobuf.TsVbuuid, error)

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

func (client *Client) RepairEndpoints(
	topic string, endpoints []string) error

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

func (client *Client) ShutdownTopic(topic string) error

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.

func (*Client) String

func (client *Client) String() string

Jump to

Keyboard shortcuts

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