diff --git a/docs/resource-guide.md b/docs/resource-guide.md index 56296581..0f1fe720 100644 --- a/docs/resource-guide.md +++ b/docs/resource-guide.md @@ -224,7 +224,7 @@ The engine might be asked to shutdown when the entire state of the system has not seen any changes for some duration of time. In order for the engine to be able to make this determination, each resource must report its converged state. To do this, the `Watch` method should get the `ConvergedUID` handle that has -been prepared for it by the engine. This is done by calling the `Converger` +been prepared for it by the engine. This is done by calling the `ConvergerUID` method on the resource object. The result can be used to set the converged status with `SetConverged`, and to notify when the particular timeout has been reached by waiting on `ConvergedTimer`. @@ -237,7 +237,7 @@ thing, but provide a `select`-free interface for different coding situations. ```golang // Watch is the listener and main loop for this resource. func (obj *FooRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // setup the Foo resource var err error diff --git a/resources/exec.go b/resources/exec.go index b6743b7d..80dc6972 100644 --- a/resources/exec.go +++ b/resources/exec.go @@ -110,7 +110,7 @@ func (obj *ExecRes) BufioChanScanner(scanner *bufio.Scanner) (chan string, chan // Watch is the primary listener for this resource and it outputs events. func (obj *ExecRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status var send = false // send event? var exit = false diff --git a/resources/file.go b/resources/file.go index a61262c5..10e84004 100644 --- a/resources/file.go +++ b/resources/file.go @@ -141,7 +141,7 @@ func (obj *FileRes) Validate() error { // must be restarted. On a clean exit it returns nil. // FIXME: Also watch the source directory when using obj.Source !!! func (obj *FileRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status var err error obj.recWatcher, err = recwatch.NewRecWatcher(obj.Path, obj.Recurse) diff --git a/resources/hostname.go b/resources/hostname.go index 552166eb..48dc9ab1 100644 --- a/resources/hostname.go +++ b/resources/hostname.go @@ -108,7 +108,7 @@ func (obj *HostnameRes) Validate() error { // Watch is the primary listener for this resource and it outputs events. func (obj *HostnameRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // if we share the bus with others, we will get each others messages!! bus, err := util.SystemBusPrivateUsable() // don't share the bus connection! diff --git a/resources/msg.go b/resources/msg.go index 38b1b3dc..94bd51d4 100644 --- a/resources/msg.go +++ b/resources/msg.go @@ -135,7 +135,7 @@ func (obj *MsgRes) journalPriority() journal.Priority { // Watch is the primary listener for this resource and it outputs events. func (obj *MsgRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // notify engine that we're running if err := obj.Running(processChan); err != nil { diff --git a/resources/noop.go b/resources/noop.go index c77e640d..efc22c8b 100644 --- a/resources/noop.go +++ b/resources/noop.go @@ -59,7 +59,7 @@ func (obj *NoopRes) Validate() error { // Watch is the primary listener for this resource and it outputs events. func (obj *NoopRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // notify engine that we're running if err := obj.Running(processChan); err != nil { diff --git a/resources/nspawn.go b/resources/nspawn.go index 5a6fa043..f66df22e 100644 --- a/resources/nspawn.go +++ b/resources/nspawn.go @@ -95,7 +95,7 @@ func (obj *NspawnRes) Validate() error { // Watch for state changes and sends a message to the bus if there is a change func (obj *NspawnRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // this resource depends on systemd ensure that it's running if !systemdUtil.IsRunningSystemd() { diff --git a/resources/password.go b/resources/password.go index 06ffba5e..efdc16bf 100644 --- a/resources/password.go +++ b/resources/password.go @@ -168,7 +168,7 @@ Loop: // Watch is the primary listener for this resource and it outputs events. func (obj *PasswordRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status var err error obj.recWatcher, err = recwatch.NewRecWatcher(obj.path, false) diff --git a/resources/pkg.go b/resources/pkg.go index 497067eb..b2d4e415 100644 --- a/resources/pkg.go +++ b/resources/pkg.go @@ -109,7 +109,7 @@ func (obj *PkgRes) Validate() error { // TODO: https://github.com/hughsie/PackageKit/issues/109 // TODO: https://github.com/hughsie/PackageKit/issues/110 func (obj *PkgRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status bus := packagekit.NewBus() if bus == nil { diff --git a/resources/resources.go b/resources/resources.go index 5adf8ad7..ad4e79f0 100644 --- a/resources/resources.go +++ b/resources/resources.go @@ -132,7 +132,7 @@ type Base interface { SetWatching(bool) RegisterConverger() UnregisterConverger() - Converger() converger.ConvergerUID + ConvergerUID() converger.ConvergerUID GetState() ResState SetState(ResState) DoSend(chan event.Event, string) (bool, error) @@ -307,9 +307,9 @@ func (obj *BaseRes) UnregisterConverger() { obj.cuid.Unregister() } -// Converger returns the ConvergerUID for the resource. This should be called +// ConvergerUID returns the ConvergerUID for the resource. This should be called // by the Watch method of the resource to set the converged state. -func (obj *BaseRes) Converger() converger.ConvergerUID { +func (obj *BaseRes) ConvergerUID() converger.ConvergerUID { return obj.cuid } diff --git a/resources/sendrecv.go b/resources/sendrecv.go index 6be71286..6a349a60 100644 --- a/resources/sendrecv.go +++ b/resources/sendrecv.go @@ -112,7 +112,7 @@ func (obj *BaseRes) ReadEvent(ev *event.Event) (exit, send bool) { // This signals to the engine to kick off the initial CheckApply resource check. func (obj *BaseRes) Running(processChan chan event.Event) error { obj.StateOK(false) // assume we're initially dirty - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status cuid.SetConverged(false) // a reasonable initial assumption close(obj.started) // send started signal diff --git a/resources/svc.go b/resources/svc.go index f58c0b9f..02325e4c 100644 --- a/resources/svc.go +++ b/resources/svc.go @@ -75,7 +75,7 @@ func (obj *SvcRes) Validate() error { // Watch is the primary listener for this resource and it outputs events. func (obj *SvcRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // obj.Name: svc name if !systemdUtil.IsRunningSystemd() { diff --git a/resources/timer.go b/resources/timer.go index 2fc9ca6c..6b7ac684 100644 --- a/resources/timer.go +++ b/resources/timer.go @@ -74,7 +74,7 @@ func (obj *TimerRes) newTicker() *time.Ticker { // Watch is the primary listener for this resource and it outputs events. func (obj *TimerRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status // create a time.Ticker for the given interval obj.ticker = obj.newTicker() diff --git a/resources/virt.go b/resources/virt.go index 5e7c6e34..dc8b923c 100644 --- a/resources/virt.go +++ b/resources/virt.go @@ -132,7 +132,7 @@ func (obj *VirtRes) connect() (conn libvirt.VirConnection, err error) { // Watch is the primary listener for this resource and it outputs events. func (obj *VirtRes) Watch(processChan chan event.Event) error { - cuid := obj.Converger() // get the converger uid used to report status + cuid := obj.ConvergerUID() // get the converger uid used to report status conn, err := obj.connect() if err != nil {