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:
James Shubin
2017-03-04 19:29:45 -05:00
parent 32aae8f57a
commit 44771a0049
4 changed files with 18 additions and 17 deletions

View File

@@ -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