gapi: Move the World interface into resources
This was necessary to fix some "import cycle" errors I was having when adding the World api to the resource Data struct. I think this is a good hint that I need to start splitting up existing packages into sub files, and cleaning up and inter-package problems too.
This commit is contained in:
16
gapi/gapi.go
16
gapi/gapi.go
@@ -23,24 +23,10 @@ import (
|
||||
"github.com/purpleidea/mgmt/resources"
|
||||
)
|
||||
|
||||
// World is an interface to the rest of the different graph state. It allows
|
||||
// the 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.
|
||||
type World interface { // TODO: is there a better name for this interface?
|
||||
ResExport([]resources.Res) error
|
||||
// FIXME: should this method take a "filter" data struct instead of many args?
|
||||
ResCollect(hostnameFilter, kindFilter []string) ([]resources.Res, error)
|
||||
|
||||
StrWatch(namespace string) chan error
|
||||
StrGet(namespace string) (map[string]string, error)
|
||||
StrSet(namespace, value string) error
|
||||
StrDel(namespace string) error
|
||||
}
|
||||
|
||||
// Data is the set of input values passed into the GAPI structs via Init.
|
||||
type Data struct {
|
||||
Hostname string // uuid for the host, required for GAPI
|
||||
World World
|
||||
World resources.World
|
||||
Noop bool
|
||||
NoWatch bool
|
||||
// NOTE: we can add more fields here if needed by GAPI endpoints
|
||||
|
||||
Reference in New Issue
Block a user