Documentation ¶
Index ¶
- Constants
- func ReportBackendInstance(c int)
- func ReportBackendOperationCompleted(operation string, err error, start time.Time)
- func WithTimeout(ctx context.Context) (context.Context, context.CancelFunc)
- type ActionType
- type CacheMode
- type CompareOp
- type CompareOperation
- func CmpCreateRev(key []byte) CompareOperation
- func CmpModRev(key []byte) CompareOperation
- func CmpStrCreateRev(key string) CompareOperation
- func CmpStrModRev(key string) CompareOperation
- func CmpStrVal(key string) CompareOperation
- func CmpStrVer(key string) CompareOperation
- func CmpVal(key []byte) CompareOperation
- func CmpVer(key []byte) CompareOperation
- type CompareResult
- type CompareType
- type Config
- type Operation
- type PluginOp
- type PluginOpOption
- func WatchPrefixOpOptions(key string) []PluginOpOption
- func WithAscendOrder() PluginOpOption
- func WithCacheOnly() PluginOpOption
- func WithCountOnly() PluginOpOption
- func WithDescendOrder() PluginOpOption
- func WithEndKey(key []byte) PluginOpOption
- func WithGlobal() PluginOpOption
- func WithIgnoreLease() PluginOpOption
- func WithKey(key []byte) PluginOpOption
- func WithKeyOnly() PluginOpOption
- func WithLease(leaseID int64) PluginOpOption
- func WithLimit(i int64) PluginOpOption
- func WithNoCache() PluginOpOption
- func WithNoneOrder() PluginOpOption
- func WithOffset(i int64) PluginOpOption
- func WithPrefix() PluginOpOption
- func WithPrevKv() PluginOpOption
- func WithRev(revision int64) PluginOpOption
- func WithStrEndKey(key string) PluginOpOption
- func WithStrKey(key string) PluginOpOption
- func WithStrValue(value string) PluginOpOption
- func WithValue(value []byte) PluginOpOption
- func WithWatchCallback(f WatchCallback) PluginOpOption
- type PluginResponse
- type Registry
- type SortOrder
- type WatchCallback
Constants ¶
View Source
const ( // grpc does not allow to transport a large body more then 4MB in a request DefaultPageCount = 4096 DefaultClusterName = "default" )
Variables ¶
This section is empty.
Functions ¶
func ReportBackendInstance ¶
func ReportBackendInstance(c int)
func WithTimeout ¶
Types ¶
type ActionType ¶
type ActionType int
const ( Get ActionType = iota Put Delete )
func (ActionType) String ¶
func (at ActionType) String() string
type CompareOp ¶
type CompareOp struct { Key []byte Type CompareType Result CompareResult Value interface{} }
func OpCmp ¶
func OpCmp(opt CompareOperation, result CompareResult, v interface{}) (cmp CompareOp)
type CompareOperation ¶
type CompareOperation func(op *CompareOp)
func CmpCreateRev ¶
func CmpCreateRev(key []byte) CompareOperation
func CmpModRev ¶
func CmpModRev(key []byte) CompareOperation
func CmpStrCreateRev ¶
func CmpStrCreateRev(key string) CompareOperation
func CmpStrModRev ¶
func CmpStrModRev(key string) CompareOperation
func CmpStrVal ¶
func CmpStrVal(key string) CompareOperation
func CmpStrVer ¶
func CmpStrVer(key string) CompareOperation
func CmpVal ¶
func CmpVal(key []byte) CompareOperation
func CmpVer ¶
func CmpVer(key []byte) CompareOperation
type CompareResult ¶
type CompareResult int
const ( CmpEqual CompareResult = iota CmpGreater CmpLess CmpNotEqual )
func (CompareResult) String ¶
func (cr CompareResult) String() string
type CompareType ¶
type CompareType int
const ( CmpVersion CompareType = iota CmpCreate CmpMod CmpValue )
func (CompareType) String ¶
func (ct CompareType) String() string
type Config ¶
type Config struct { SslEnabled bool `json:"-"` ManagerAddress string `json:"manageAddress,omitempty"` ClusterName string `json:"manageName,omitempty"` ClusterAddresses string `json:"manageClusters,omitempty"` // the raw string of cluster configuration Clusters types.Clusters `json:"-"` // parsed from ClusterAddresses DialTimeout time.Duration `json:"connectTimeout"` RequestTimeOut time.Duration `json:"registryTimeout"` AutoSyncInterval time.Duration `json:"autoSyncInterval"` }
func Configuration ¶
func Configuration() *Config
func (*Config) InitClusterInfo ¶
func (c *Config) InitClusterInfo()
InitClusterInfo re-org address info with node name
func (*Config) RegistryAddresses ¶
RegistryAddresses return the address of current SC's registry backend
type Operation ¶
type Operation func(...PluginOpOption) (op PluginOp)
type PluginOp ¶
type PluginOp struct { Action ActionType Key []byte EndKey []byte Value []byte Prefix bool PrevKV bool Lease int64 KeyOnly bool CountOnly bool SortOrder SortOrder Revision int64 IgnoreLease bool Mode CacheMode WatchCallback WatchCallback Offset int64 Limit int64 Global bool }
func OpDel ¶
func OpDel(opts ...PluginOpOption) (op PluginOp)
func OpGet ¶
func OpGet(opts ...PluginOpOption) (op PluginOp)
func OpPut ¶
func OpPut(opts ...PluginOpOption) (op PluginOp)
func OptionsToOp ¶
func OptionsToOp(opts ...PluginOpOption) (op PluginOp)
func (PluginOp) FormatURLParams ¶
type PluginOpOption ¶
type PluginOpOption func(*PluginOp)
var DEL PluginOpOption = func(op *PluginOp) { op.Action = Delete }
var GET PluginOpOption = func(op *PluginOp) { op.Action = Get }
var PUT PluginOpOption = func(op *PluginOp) { op.Action = Put }
func WatchPrefixOpOptions ¶
func WatchPrefixOpOptions(key string) []PluginOpOption
func WithAscendOrder ¶
func WithAscendOrder() PluginOpOption
func WithCacheOnly ¶
func WithCacheOnly() PluginOpOption
func WithCountOnly ¶
func WithCountOnly() PluginOpOption
func WithDescendOrder ¶
func WithDescendOrder() PluginOpOption
func WithEndKey ¶
func WithEndKey(key []byte) PluginOpOption
func WithGlobal ¶
func WithGlobal() PluginOpOption
func WithIgnoreLease ¶
func WithIgnoreLease() PluginOpOption
func WithKey ¶
func WithKey(key []byte) PluginOpOption
func WithKeyOnly ¶
func WithKeyOnly() PluginOpOption
func WithLease ¶
func WithLease(leaseID int64) PluginOpOption
func WithLimit ¶
func WithLimit(i int64) PluginOpOption
func WithNoCache ¶
func WithNoCache() PluginOpOption
func WithNoneOrder ¶
func WithNoneOrder() PluginOpOption
func WithOffset ¶
func WithOffset(i int64) PluginOpOption
func WithPrefix ¶
func WithPrefix() PluginOpOption
func WithPrevKv ¶
func WithPrevKv() PluginOpOption
func WithRev ¶
func WithRev(revision int64) PluginOpOption
func WithStrEndKey ¶
func WithStrEndKey(key string) PluginOpOption
func WithStrKey ¶
func WithStrKey(key string) PluginOpOption
func WithStrValue ¶
func WithStrValue(value string) PluginOpOption
func WithValue ¶
func WithValue(value []byte) PluginOpOption
func WithWatchCallback ¶
func WithWatchCallback(f WatchCallback) PluginOpOption
type PluginResponse ¶
type PluginResponse struct { Action ActionType Kvs []*mvccpb.KeyValue Count int64 Revision int64 Succeeded bool }
func (*PluginResponse) MaxModRevision ¶
func (pr *PluginResponse) MaxModRevision() (max int64)
func (*PluginResponse) String ¶
func (pr *PluginResponse) String() string
type Registry ¶
type Registry interface { Err() <-chan error Ready() <-chan struct{} PutNoOverride(ctx context.Context, opts ...PluginOpOption) (bool, error) Do(ctx context.Context, opts ...PluginOpOption) (*PluginResponse, error) Txn(ctx context.Context, ops []PluginOp) (*PluginResponse, error) TxnWithCmp(ctx context.Context, success []PluginOp, cmp []CompareOp, fail []PluginOp) (*PluginResponse, error) LeaseGrant(ctx context.Context, TTL int64) (leaseID int64, err error) LeaseRenew(ctx context.Context, leaseID int64) (TTL int64, err error) LeaseRevoke(ctx context.Context, leaseID int64) error // this function block util: // 1. connection error // 2. call send function failed // 3. response.Err() // 4. time out to watch, but return nil Watch(ctx context.Context, opts ...PluginOpOption) error Compact(ctx context.Context, reserve int64) error Close() }
type WatchCallback ¶
type WatchCallback func(message string, evt *PluginResponse) error
Click to show internal directories.
Click to hide internal directories.