client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const Brain = "brain"

Variables

This section is empty.

Functions

func PrefixEnd

func PrefixEnd(prefix string) string

func WithLimit

func WithLimit(limit int64) *withLimit

func WithMaxConcurrent

func WithMaxConcurrent(n uint) *withMaxConcurrent

func WithPrefix

func WithPrefix() *withPrefix

func WithRevision

func WithRevision(rev uint64) *withRevision

func WithTTL

func WithTTL(ttl int64) *withTTL

Types

type Client

type Client interface {
	// Create stores a new kv
	Create(ctx context.Context, key, val string, opts ...CreateOption) (*CreateResponse, error)

	// Update updates value indexed by given key
	Update(ctx context.Context, key, val string, rev uint64, opts ...UpdateOption) (*UpdateResponse, error)

	// Get reads single kv
	Get(ctx context.Context, key string, opts ...GetOption) (*GetResponse, error)

	// Range reads multiple kvs indexed by keys in [start, end)
	Range(ctx context.Context, start string, end string, opts ...RangeOption) (*RangeResponse, error)

	// Delete removes data
	Delete(ctx context.Context, key string, opts ...DeleteOption) (*DeleteResponse, error)

	// Compact compacts data
	Compact(ctx context.Context, rev uint64, opts ...CompactOption) (*CompactResponse, error)

	// Watch traces event with prefix
	Watch(ctx context.Context, key string, opts ...WatchOption) WatchChan

	// RangeStream reads kvs indexed by keys in [start, end) through stream
	RangeStream(ctx context.Context, start string, end string, opts ...RangeStreamOption) RangeStreamChan

	// Count counts num of kvs in [start, end)
	Count(ctx context.Context, start string, end string, opts ...CountOption) (*CountResponse, error)

	// Close closes client
	Close() error
}

func NewClient

func NewClient(config Config) (Client, error)

type CompactOption

type CompactOption interface {
	// contains filtered or unexported methods
}

type CompactRequest

type CompactRequest rpc.CompactRequest

type CompactResponse

type CompactResponse rpc.CompactResponse

type Config

type Config struct {
	// Endpoints is a list of URLs
	Endpoints []string `json:"endpoints"`

	// TLS is the tls config for handshake with server
	TLS *tls.Config

	// LogLevel is the level of info log
	LogLevel klog.Level `json:"log-level"`

	// MaxCallSendMsgSize is the client-side request send limit in bytes.
	// If 0, it defaults to 2.0 MiB (2 * 1024 * 1024).
	// Make sure that "MaxCallSendMsgSize" < server-side default send/recv limit.
	MaxCallSendMsgSize int `json:"max-call-send-msg-size"`

	// MaxCallRecvMsgSize is the client-side response receive limit.
	// If 0, it defaults to "math.MaxInt32", because range response can
	// easily exceed request send limits.
	// Make sure that "MaxCallRecvMsgSize" >= server-side default send/recv limit.
	MaxCallRecvMsgSize int `json:"max-call-recv-msg-size"`
}

Config is the configuration of client

type CountOption

type CountOption interface {
	// contains filtered or unexported methods
}

type CountRequest

type CountRequest rpc.CountRequest

type CountResponse

type CountResponse rpc.CountResponse

type CreateOption

type CreateOption interface {
	// contains filtered or unexported methods
}

type CreateRequest

type CreateRequest rpc.CreateRequest

type CreateResponse

type CreateResponse rpc.CreateResponse

type DeleteOption

type DeleteOption interface {
	// contains filtered or unexported methods
}

type DeleteRequest

type DeleteRequest rpc.DeleteRequest

type DeleteResponse

type DeleteResponse rpc.DeleteResponse

type Event

type Event rpc.Event

type GetOption

type GetOption interface {
	// contains filtered or unexported methods
}

type GetRequest

type GetRequest rpc.GetRequest

type GetResponse

type GetResponse rpc.GetResponse

type Group

type Group interface {
	Go(f func() error)
	Wait() error
}

func NewConcurrentLimitGroup

func NewConcurrentLimitGroup(ctx context.Context, concurrentMax int) (Group, context.Context)

type LimitErrGroup

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

func (*LimitErrGroup) Go

func (g *LimitErrGroup) Go(f func() error)

func (*LimitErrGroup) Wait

func (g *LimitErrGroup) Wait() error

type ListPartitionRequest

type ListPartitionRequest rpc.ListPartitionRequest

type ListPartitionResponse

type ListPartitionResponse rpc.ListPartitionResponse

type RangeOption

type RangeOption interface {
	// contains filtered or unexported methods
}

type RangeRequest

type RangeRequest rpc.RangeRequest

type RangeResponse

type RangeResponse rpc.RangeResponse

type RangeStreamChan

type RangeStreamChan <-chan StreamRangeResponse

type RangeStreamOption

type RangeStreamOption interface {
	// contains filtered or unexported methods
}

type RangeStreamRequest

type RangeStreamRequest struct {
	*rpc.RangeRequest
	// contains filtered or unexported fields
}

type StreamRangeResponse

type StreamRangeResponse struct {
	*RangeResponse
	// contains filtered or unexported fields
}

func (*StreamRangeResponse) Err

func (s *StreamRangeResponse) Err() error

type UpdateOption

type UpdateOption interface {
	// contains filtered or unexported methods
}

type UpdateRequest

type UpdateRequest rpc.UpdateRequest

type UpdateResponse

type UpdateResponse rpc.UpdateResponse

type WatchChan

type WatchChan <-chan WatchResponse

type WatchOption

type WatchOption interface {
	// contains filtered or unexported methods
}

type WatchRequest

type WatchRequest rpc.WatchRequest

type WatchResponse

type WatchResponse struct {
	Header *rpc.ResponseHeader
	Events []*rpc.Event
	// contains filtered or unexported fields
}

func (*WatchResponse) Err

func (s *WatchResponse) Err() error

Directories

Path Synopsis
balancer

Jump to

Keyboard shortcuts

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