diff --git a/docs/resource-guide.md b/docs/resource-guide.md index 7577cda6..091ebcdf 100644 --- a/docs/resource-guide.md +++ b/docs/resource-guide.md @@ -37,7 +37,7 @@ along with this program. If not, see . * [CheckApply - Check and apply resource state](#checkapply) * [Watch - Detect resource changes](#watch) * [Compare - Compare resource with another](#compare) - * [GetUIDs - Returns the list of resource UID's](#getuids) + * [UIDs - Returns the list of resource UID's](#uids) * [AutoEdges - Returns the autoedge interface matcher](#autoedges) * [CollectPattern - Currently a stub, API will change](#collectpattern) * [(UnmarshalYAML) - Optional, sets the YAML defaults](#unmarshalyaml) @@ -412,12 +412,12 @@ func (obj *FooRes) Compare(res Res) bool { } ``` -### GetUIDs +### UIDs ```golang -GetUIDs() []ResUID +UIDs() []ResUID ``` -The `GetUIDs` method returns a list of `ResUID` interfaces that represent the +The `UIDs` method returns a list of `ResUID` interfaces that represent the particular resource uniquely. This is used with the AutoEdges API to determine if another resource can match a dependency to this one. diff --git a/pgraph/autoedge.go b/pgraph/autoedge.go index 77af91c8..d58daddf 100644 --- a/pgraph/autoedge.go +++ b/pgraph/autoedge.go @@ -45,7 +45,7 @@ func (g *Graph) addEdgesByMatchingUIDS(v *Vertex, uids []resources.ResUID) []boo // that is to say, the name value of a res is a helpful // handle, but it is not necessarily a unique identity! // remember, resources can return multiple UID's each! - if resources.UIDExistsInUIDs(uid, vv.GetUIDs()) { + if resources.UIDExistsInUIDs(uid, vv.UIDs()) { // add edge from: vv -> v if uid.Reversed() { txt := fmt.Sprintf("AutoEdge: %v[%v] -> %v[%v]", vv.Kind(), vv.GetName(), v.Kind(), v.GetName()) diff --git a/resources/exec.go b/resources/exec.go index 36e24291..1bd7edf0 100644 --- a/resources/exec.go +++ b/resources/exec.go @@ -363,9 +363,9 @@ func (obj *ExecRes) AutoEdges() AutoEdge { return nil } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *ExecRes) GetUIDs() []ResUID { +func (obj *ExecRes) UIDs() []ResUID { x := &ExecUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, Cmd: obj.Cmd, diff --git a/resources/file.go b/resources/file.go index f21d77ec..8e2b88a7 100644 --- a/resources/file.go +++ b/resources/file.go @@ -733,9 +733,9 @@ func (obj *FileRes) AutoEdges() AutoEdge { } } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *FileRes) GetUIDs() []ResUID { +func (obj *FileRes) UIDs() []ResUID { x := &FileUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, path: obj.path, diff --git a/resources/hostname.go b/resources/hostname.go index be0c9966..747394fe 100644 --- a/resources/hostname.go +++ b/resources/hostname.go @@ -242,9 +242,9 @@ func (obj *HostnameRes) AutoEdges() AutoEdge { return nil } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *HostnameRes) GetUIDs() []ResUID { +func (obj *HostnameRes) UIDs() []ResUID { x := &HostnameUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, name: obj.Name, diff --git a/resources/msg.go b/resources/msg.go index 4320469c..7c6c4e35 100644 --- a/resources/msg.go +++ b/resources/msg.go @@ -209,9 +209,9 @@ func (obj *MsgRes) CheckApply(apply bool) (bool, error) { return false, nil } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *MsgRes) GetUIDs() []ResUID { +func (obj *MsgRes) UIDs() []ResUID { x := &MsgUID{ BaseUID: BaseUID{ name: obj.GetName(), diff --git a/resources/noop.go b/resources/noop.go index a8141adb..af2f7bf7 100644 --- a/resources/noop.go +++ b/resources/noop.go @@ -107,9 +107,9 @@ func (obj *NoopRes) AutoEdges() AutoEdge { return nil } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *NoopRes) GetUIDs() []ResUID { +func (obj *NoopRes) UIDs() []ResUID { x := &NoopUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, name: obj.Name, diff --git a/resources/nspawn.go b/resources/nspawn.go index 93c82362..577fffc2 100644 --- a/resources/nspawn.go +++ b/resources/nspawn.go @@ -262,14 +262,14 @@ func (obj *NspawnUID) IFF(uid ResUID) bool { return obj.name == res.name } -// GetUIDs includes all params to make a unique identification of this object +// UIDs includes all params to make a unique identification of this object // most resources only return one although some resources can return multiple -func (obj *NspawnRes) GetUIDs() []ResUID { +func (obj *NspawnRes) UIDs() []ResUID { x := &NspawnUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, name: obj.Name, // svc name } - return append([]ResUID{x}, obj.svc.GetUIDs()...) + return append([]ResUID{x}, obj.svc.UIDs()...) } // GroupCmp returns whether two resources can be grouped together or not diff --git a/resources/password.go b/resources/password.go index 2ce18ec6..afea32eb 100644 --- a/resources/password.go +++ b/resources/password.go @@ -308,9 +308,9 @@ func (obj *PasswordRes) AutoEdges() AutoEdge { return nil } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *PasswordRes) GetUIDs() []ResUID { +func (obj *PasswordRes) UIDs() []ResUID { x := &PasswordUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, name: obj.Name, diff --git a/resources/pkg.go b/resources/pkg.go index fc8eea3e..09741fc7 100644 --- a/resources/pkg.go +++ b/resources/pkg.go @@ -458,9 +458,9 @@ func (obj *PkgRes) AutoEdges() AutoEdge { } } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *PkgRes) GetUIDs() []ResUID { +func (obj *PkgRes) UIDs() []ResUID { x := &PkgUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, name: obj.Name, diff --git a/resources/resources.go b/resources/resources.go index 1c1ea93d..aab7f910 100644 --- a/resources/resources.go +++ b/resources/resources.go @@ -172,7 +172,7 @@ type Res interface { Validate() error Init() error Close() error - GetUIDs() []ResUID // most resources only return one + UIDs() []ResUID // most resources only return one Watch(chan *event.Event) error // send on channel to signal process() events CheckApply(apply bool) (checkOK bool, err error) AutoEdges() AutoEdge diff --git a/resources/svc.go b/resources/svc.go index 66bcddd2..ff4571b0 100644 --- a/resources/svc.go +++ b/resources/svc.go @@ -396,9 +396,9 @@ func (obj *SvcRes) AutoEdges() AutoEdge { } } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *SvcRes) GetUIDs() []ResUID { +func (obj *SvcRes) UIDs() []ResUID { x := &SvcUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, name: obj.Name, // svc name diff --git a/resources/timer.go b/resources/timer.go index 3ae6266e..5d87280f 100644 --- a/resources/timer.go +++ b/resources/timer.go @@ -124,9 +124,9 @@ func (obj *TimerRes) CheckApply(apply bool) (bool, error) { return false, nil } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *TimerRes) GetUIDs() []ResUID { +func (obj *TimerRes) UIDs() []ResUID { x := &TimerUID{ BaseUID: BaseUID{ name: obj.GetName(), diff --git a/resources/virt.go b/resources/virt.go index 64784126..37401cdb 100644 --- a/resources/virt.go +++ b/resources/virt.go @@ -681,9 +681,9 @@ type VirtUID struct { BaseUID } -// GetUIDs includes all params to make a unique identification of this object. +// UIDs includes all params to make a unique identification of this object. // Most resources only return one, although some resources can return multiple. -func (obj *VirtRes) GetUIDs() []ResUID { +func (obj *VirtRes) UIDs() []ResUID { x := &VirtUID{ BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()}, // TODO: add more properties here so we can link to vm dependencies