resources: Rename GetUIDs to UIDs
This is more in line with the style guide for golang.
This commit is contained in:
@@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
* [CheckApply - Check and apply resource state](#checkapply)
|
* [CheckApply - Check and apply resource state](#checkapply)
|
||||||
* [Watch - Detect resource changes](#watch)
|
* [Watch - Detect resource changes](#watch)
|
||||||
* [Compare - Compare resource with another](#compare)
|
* [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)
|
* [AutoEdges - Returns the autoedge interface matcher](#autoedges)
|
||||||
* [CollectPattern - Currently a stub, API will change](#collectpattern)
|
* [CollectPattern - Currently a stub, API will change](#collectpattern)
|
||||||
* [(UnmarshalYAML) - Optional, sets the YAML defaults](#unmarshalyaml)
|
* [(UnmarshalYAML) - Optional, sets the YAML defaults](#unmarshalyaml)
|
||||||
@@ -412,12 +412,12 @@ func (obj *FooRes) Compare(res Res) bool {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### GetUIDs
|
### UIDs
|
||||||
```golang
|
```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
|
particular resource uniquely. This is used with the AutoEdges API to determine
|
||||||
if another resource can match a dependency to this one.
|
if another resource can match a dependency to this one.
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
// that is to say, the name value of a res is a helpful
|
||||||
// handle, but it is not necessarily a unique identity!
|
// handle, but it is not necessarily a unique identity!
|
||||||
// remember, resources can return multiple UID's each!
|
// 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
|
// add edge from: vv -> v
|
||||||
if uid.Reversed() {
|
if uid.Reversed() {
|
||||||
txt := fmt.Sprintf("AutoEdge: %v[%v] -> %v[%v]", vv.Kind(), vv.GetName(), v.Kind(), v.GetName())
|
txt := fmt.Sprintf("AutoEdge: %v[%v] -> %v[%v]", vv.Kind(), vv.GetName(), v.Kind(), v.GetName())
|
||||||
|
|||||||
@@ -363,9 +363,9 @@ func (obj *ExecRes) AutoEdges() AutoEdge {
|
|||||||
return nil
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *ExecRes) GetUIDs() []ResUID {
|
func (obj *ExecRes) UIDs() []ResUID {
|
||||||
x := &ExecUID{
|
x := &ExecUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
Cmd: obj.Cmd,
|
Cmd: obj.Cmd,
|
||||||
|
|||||||
@@ -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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *FileRes) GetUIDs() []ResUID {
|
func (obj *FileRes) UIDs() []ResUID {
|
||||||
x := &FileUID{
|
x := &FileUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
path: obj.path,
|
path: obj.path,
|
||||||
|
|||||||
@@ -242,9 +242,9 @@ func (obj *HostnameRes) AutoEdges() AutoEdge {
|
|||||||
return nil
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *HostnameRes) GetUIDs() []ResUID {
|
func (obj *HostnameRes) UIDs() []ResUID {
|
||||||
x := &HostnameUID{
|
x := &HostnameUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
name: obj.Name,
|
name: obj.Name,
|
||||||
|
|||||||
@@ -209,9 +209,9 @@ func (obj *MsgRes) CheckApply(apply bool) (bool, error) {
|
|||||||
return false, nil
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *MsgRes) GetUIDs() []ResUID {
|
func (obj *MsgRes) UIDs() []ResUID {
|
||||||
x := &MsgUID{
|
x := &MsgUID{
|
||||||
BaseUID: BaseUID{
|
BaseUID: BaseUID{
|
||||||
name: obj.GetName(),
|
name: obj.GetName(),
|
||||||
|
|||||||
@@ -107,9 +107,9 @@ func (obj *NoopRes) AutoEdges() AutoEdge {
|
|||||||
return nil
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *NoopRes) GetUIDs() []ResUID {
|
func (obj *NoopRes) UIDs() []ResUID {
|
||||||
x := &NoopUID{
|
x := &NoopUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
name: obj.Name,
|
name: obj.Name,
|
||||||
|
|||||||
@@ -262,14 +262,14 @@ func (obj *NspawnUID) IFF(uid ResUID) bool {
|
|||||||
return obj.name == res.name
|
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
|
// most resources only return one although some resources can return multiple
|
||||||
func (obj *NspawnRes) GetUIDs() []ResUID {
|
func (obj *NspawnRes) UIDs() []ResUID {
|
||||||
x := &NspawnUID{
|
x := &NspawnUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
name: obj.Name, // svc name
|
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
|
// GroupCmp returns whether two resources can be grouped together or not
|
||||||
|
|||||||
@@ -308,9 +308,9 @@ func (obj *PasswordRes) AutoEdges() AutoEdge {
|
|||||||
return nil
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *PasswordRes) GetUIDs() []ResUID {
|
func (obj *PasswordRes) UIDs() []ResUID {
|
||||||
x := &PasswordUID{
|
x := &PasswordUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
name: obj.Name,
|
name: obj.Name,
|
||||||
|
|||||||
@@ -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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *PkgRes) GetUIDs() []ResUID {
|
func (obj *PkgRes) UIDs() []ResUID {
|
||||||
x := &PkgUID{
|
x := &PkgUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
name: obj.Name,
|
name: obj.Name,
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ type Res interface {
|
|||||||
Validate() error
|
Validate() error
|
||||||
Init() error
|
Init() error
|
||||||
Close() 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
|
Watch(chan *event.Event) error // send on channel to signal process() events
|
||||||
CheckApply(apply bool) (checkOK bool, err error)
|
CheckApply(apply bool) (checkOK bool, err error)
|
||||||
AutoEdges() AutoEdge
|
AutoEdges() AutoEdge
|
||||||
|
|||||||
@@ -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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *SvcRes) GetUIDs() []ResUID {
|
func (obj *SvcRes) UIDs() []ResUID {
|
||||||
x := &SvcUID{
|
x := &SvcUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
name: obj.Name, // svc name
|
name: obj.Name, // svc name
|
||||||
|
|||||||
@@ -124,9 +124,9 @@ func (obj *TimerRes) CheckApply(apply bool) (bool, error) {
|
|||||||
return false, nil
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *TimerRes) GetUIDs() []ResUID {
|
func (obj *TimerRes) UIDs() []ResUID {
|
||||||
x := &TimerUID{
|
x := &TimerUID{
|
||||||
BaseUID: BaseUID{
|
BaseUID: BaseUID{
|
||||||
name: obj.GetName(),
|
name: obj.GetName(),
|
||||||
|
|||||||
@@ -681,9 +681,9 @@ type VirtUID struct {
|
|||||||
BaseUID
|
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.
|
// Most resources only return one, although some resources can return multiple.
|
||||||
func (obj *VirtRes) GetUIDs() []ResUID {
|
func (obj *VirtRes) UIDs() []ResUID {
|
||||||
x := &VirtUID{
|
x := &VirtUID{
|
||||||
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
BaseUID: BaseUID{name: obj.GetName(), kind: obj.Kind()},
|
||||||
// TODO: add more properties here so we can link to vm dependencies
|
// TODO: add more properties here so we can link to vm dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user