Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWatchFailed = fmt.Errorf("etcd watch returns a nil chan") ErrNoKey = fmt.Errorf("etcd has no such key") ErrTxnFailed = fmt.Errorf("role changed or target revision mismatch") ErrTxnConvert = fmt.Errorf("cannot covert etcd transaction") )
View Source
var ErrNotExist = fmt.Errorf("discovery is not exist")
Functions ¶
Types ¶
type Discovery ¶
type Discovery interface { // 从service center中获得数据 Get(ctx context.Context, key string) ([]byte, error) // 根据key获得value List(ctx context.Context, prefix string) ([]KeyValue, error) // 根据前缀获得数据 Put(ctx context.Context, key string, val []byte) error // key-value写入, 为了控制面使用 Delete(ctx context.Context, key string) error // 删除key,为了控制面使用 Heartbeat(ctx context.Context, key string, value []byte, ttl int64) (<-chan Closed, error) // endponit 健康检查 Elect(ctx context.Context, key string, value []byte, ttl int64) (bool, <-chan Closed, error) // 选举写入: key 不存在,写入成功,返回成功;key存在,写入失败,返回error Watch(ctx context.Context, key string, fetchVal bool) WatchEventChan // watch key WatchPrefix(ctx context.Context, prefixKey string, fetchVal bool) WatchEventChan // watch 前缀key Batch(ctx context.Context, batch Batch) (bool, error) // 批写入 NewTransaction() Transaction // 新transaction Commit(ctx context.Context, txn Transaction) error // commit Close() error // close discovery }
type DiscoveryFactory ¶
func NewDiscoveryFactory ¶
func NewDiscoveryFactory(owner string) DiscoveryFactory
type Event ¶
type Event struct { Type EventType KeyValues []EventKeyValue Err error }
定义 discovery watch 健值或者前缀的event
type EventKeyValue ¶
type Transaction ¶
Click to show internal directories.
Click to hide internal directories.