initial commit

This commit is contained in:
ston1th 2020-11-22 12:59:12 +01:00
commit 7715fcf373
37 changed files with 2957 additions and 0 deletions

33
pkg/cluster/cluster.go Normal file
View file

@ -0,0 +1,33 @@
package cluster
import (
"context"
"git.giftfish.de/ston1th/vipman/pkg/config"
"github.com/go-logr/logr"
)
type Cluster interface {
Start(*config.Config) error
SetCallbacks(Callbacks) error
Stepdown()
Stop()
}
type KV interface {
Get(k string) ([]byte, error)
Set(k string, v []byte) error
Delete(k string) error
}
type CallbackContext interface {
logr.Logger
KV
ID() string
}
type Callbacks struct {
Leader func(context.Context, CallbackContext)
Follower func(context.Context, CallbackContext)
Cleanup func(context.Context, CallbackContext)
}