initial commit
This commit is contained in:
commit
7715fcf373
37 changed files with 2957 additions and 0 deletions
33
pkg/cluster/cluster.go
Normal file
33
pkg/cluster/cluster.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue