Documentation
¶
Index ¶
- Constants
- func ServiceConfigKey(path, service string) string
- func ServiceDiscoveryKey(path, service, node string) string
- func ServiceDiscoveryPrefixKey(path string) string
- func ServiceNodeIDIncrKey(path, service string) string
- func ServiceOpsKey(path, service, node string) string
- type ConfigItem
- type ConfigItems
- type EventChan
- type EventType
- type KVPair
- type KVPairs
- type Provider
- type WatchEvent
Constants ¶
View Source
const ( Memory = "memory" // For debug or test usage. Etcd = "etcd" )
View Source
const ( DialTimeout = time.Second * 3 RetryTimeout = time.Second * 3 ReadTimeout = time.Second * 3 WriteTimeout = time.Second * 3 KeepAliveTime = time.Second * 5 )
View Source
const ( ServicePrefix = "service" ServiceOpsPrefix = "ops" ServiceNodeIDKey = "node_id" )
View Source
const (
ConfigPrefix = "config"
)
View Source
const (
DefaultChanLen = 1000
)
Variables ¶
This section is empty.
Functions ¶
func ServiceConfigKey ¶
func ServiceDiscoveryKey ¶
func ServiceNodeIDIncrKey ¶
func ServiceOpsKey ¶
Types ¶
type ConfigItem ¶
type ConfigItem struct {
Type string `json:"type"`
Hint string `json:"hint"`
Value string `json:"value"`
Comment string `json:"comment"`
}
func (ConfigItem) String ¶
func (c ConfigItem) String() string
type ConfigItems ¶
type ConfigItems map[string]*ConfigItem
func (ConfigItems) Add ¶
func (c ConfigItems) Add(items ConfigItems)
type EventChan ¶
type EventChan chan *WatchEvent
type Provider ¶
type Provider interface {
// Type returns the provider type.
Type() string
// Set value for the specified key with a specified ttl.
Set(key, value string, ttl time.Duration) error
// Get the value of the specified key or directory.
Get(key string, dir bool) (KVPairs, error)
// Incr invokes an atomic value increase for the specified key.
Incr(key string) (int64, error)
// Delete the specified key or directory.
Delete(key string, dir bool) error
// Watch for changes of the specified key or directory.
Watch(key string, dir bool) (EventChan, error)
// KeepAlive sets value and updates the ttl for the specified key.
KeepAlive(key, value string, ttl time.Duration) error
// Close the provider connection.
Close() error
}
Provider interface.
type WatchEvent ¶
Click to show internal directories.
Click to hide internal directories.