resources: Rename GetUIDs to UIDs

This is more in line with the style guide for golang.
This commit is contained in:
James Shubin
2017-01-25 14:49:28 -05:00
parent d8c4f78ec1
commit 9421f2cddd
14 changed files with 29 additions and 29 deletions

View File

@@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* [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.

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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(),

View File

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