engine: Split out the str world interface
This is a core API and it should really be cleaned up if possible.
This commit is contained in:
@@ -40,20 +40,10 @@ import (
|
|||||||
// GAPI to store state and exchange information throughout the cluster. It is
|
// GAPI to store state and exchange information throughout the cluster. It is
|
||||||
// the interface each machine uses to communicate with the rest of the world.
|
// the interface each machine uses to communicate with the rest of the world.
|
||||||
type World interface { // TODO: is there a better name for this interface?
|
type World interface { // TODO: is there a better name for this interface?
|
||||||
|
StrWorld
|
||||||
|
|
||||||
ResWorld
|
ResWorld
|
||||||
|
|
||||||
StrWatch(ctx context.Context, namespace string) (chan error, error)
|
|
||||||
StrIsNotExist(error) bool
|
|
||||||
StrGet(ctx context.Context, namespace string) (string, error)
|
|
||||||
StrSet(ctx context.Context, namespace, value string) error
|
|
||||||
StrDel(ctx context.Context, namespace string) error
|
|
||||||
|
|
||||||
// XXX: add the exchange primitives in here directly?
|
|
||||||
StrMapWatch(ctx context.Context, namespace string) (chan error, error)
|
|
||||||
StrMapGet(ctx context.Context, namespace string) (map[string]string, error)
|
|
||||||
StrMapSet(ctx context.Context, namespace, value string) error
|
|
||||||
StrMapDel(ctx context.Context, namespace string) error
|
|
||||||
|
|
||||||
Scheduler(namespace string, opts ...scheduler.Option) (*scheduler.Result, error)
|
Scheduler(namespace string, opts ...scheduler.Option) (*scheduler.Result, error)
|
||||||
|
|
||||||
// URI returns the current FS URI.
|
// URI returns the current FS URI.
|
||||||
@@ -66,6 +56,24 @@ type World interface { // TODO: is there a better name for this interface?
|
|||||||
Fs(uri string) (Fs, error)
|
Fs(uri string) (Fs, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StrWorld is a world interface which is useful for reading, writing, and
|
||||||
|
// watching strings in a shared, distributed database. It is likely that much of
|
||||||
|
// the functionality is built upon these primitives.
|
||||||
|
// XXX: We should consider improving this API if possible.
|
||||||
|
type StrWorld interface {
|
||||||
|
StrWatch(ctx context.Context, namespace string) (chan error, error)
|
||||||
|
StrIsNotExist(error) bool
|
||||||
|
StrGet(ctx context.Context, namespace string) (string, error)
|
||||||
|
StrSet(ctx context.Context, namespace, value string) error
|
||||||
|
StrDel(ctx context.Context, namespace string) error
|
||||||
|
|
||||||
|
// XXX: add the exchange primitives in here directly?
|
||||||
|
StrMapWatch(ctx context.Context, namespace string) (chan error, error)
|
||||||
|
StrMapGet(ctx context.Context, namespace string) (map[string]string, error)
|
||||||
|
StrMapSet(ctx context.Context, namespace, value string) error
|
||||||
|
StrMapDel(ctx context.Context, namespace string) error
|
||||||
|
}
|
||||||
|
|
||||||
// ResWorld is a world interface that lets us store, pull and watch resources in
|
// ResWorld is a world interface that lets us store, pull and watch resources in
|
||||||
// a distributed database.
|
// a distributed database.
|
||||||
// XXX: These API's are likely to change.
|
// XXX: These API's are likely to change.
|
||||||
|
|||||||
Reference in New Issue
Block a user