added etcd support

This commit is contained in:
ston1th 2020-11-15 18:39:16 +01:00
commit 85a8ba23bd
21 changed files with 767 additions and 247 deletions

View file

@ -8,7 +8,8 @@ import (
)
type Cluster interface {
Start(logr.Logger, *config.Config) error
Start(*config.Config) error
SetCallbacks(Callbacks) error
Stepdown()
Stop()
}
@ -19,7 +20,13 @@ type KV interface {
Delete(k string) error
}
type Callbacks struct {
Leader func(context.Context, KV)
Follower func(context.Context, KV)
type CallbackContext interface {
logr.Logger
KV
ID() string
}
type Callbacks struct {
Leader func(context.Context, CallbackContext)
Follower func(context.Context, CallbackContext)
}