engine: Split out the etcd cluster size options

This is clean up work so that it's easier to generalize the world
backends.
This commit is contained in:
James Shubin
2025-03-18 03:07:27 -04:00
parent a697add8d0
commit b173d9f8ef
2 changed files with 21 additions and 7 deletions

View File

@@ -45,10 +45,6 @@ type World interface { // TODO: is there a better name for this interface?
// FIXME: should this method take a "filter" data struct instead of many args?
ResCollect(ctx context.Context, hostnameFilter, kindFilter []string) ([]Res, error)
IdealClusterSizeWatch(context.Context) (chan error, error)
IdealClusterSizeGet(context.Context) (uint16, error)
IdealClusterSizeSet(context.Context, uint16) (bool, error)
StrWatch(ctx context.Context, namespace string) (chan error, error)
StrIsNotExist(error) bool
StrGet(ctx context.Context, namespace string) (string, error)
@@ -75,3 +71,13 @@ type World interface { // TODO: is there a better name for this interface?
// WatchMembers returns a channel of changing members in the cluster.
WatchMembers(context.Context) (<-chan *interfaces.MembersResult, error)
}
// EtcdWorld is a world interface that should be implemented if the world
// backend is implementing etcd, and if it supports dynamically resizing things.
// TODO: In theory we could generalize this to support other backends, but lets
// assume it's specific to etcd only for now.
type EtcdWorld interface {
IdealClusterSizeWatch(context.Context) (chan error, error)
IdealClusterSizeGet(context.Context) (uint16, error)
IdealClusterSizeSet(context.Context, uint16) (bool, error)
}