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 )
View Source
const ( ServicePrefix = "service" ServiceOpsPrefix = "ops" ServiceNodeIDKey = "node_id" )
View Source
const (
ConfigPrefix = "config"
)
View Source
const (
DefaultChanLen = 100
)
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 {
// Return provider type
Type() string
// Set value with the specified key
Set(key, value string, ttl time.Duration) error
// Get value of the specified key or directory
Get(key string, dir bool) (KVPairs, error)
// Atomic increase 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
// Set and update ttl for the specified key
KeepAlive(key, value string, ttl time.Duration) error
// Close the provider connection
Close() error
}
Backend provider interface
type WatchEvent ¶
Click to show internal directories.
Click to hide internal directories.