// NewCommandListener makes a statemachine.CommandListener implementation
// backed by etcd. The namespace should be the same as the coordinator as
// commands use a separate path within a namespace than tasks or nodes.
NewCommandListener makes a statemachine.CommandListener implementation
backed by etcd. The namespace should be the same as the coordinator as
commands use a separate path within a namespace than tasks or nodes.
// NewCommandListener makes a statemachine . CommandListener implementation // backed by etcd . The namespace should be the same as the coordinator as // commands use a separate path within a namespace than tasks or nodes .
func NewCommandListener(conf *Config, task metafora.Task, c *etcdv3.Client) statemachine.CommandListener {
	taskcmdpath := path.Join("/", conf.Namespace, TasksPath, task.ID(), CommandsPath)
	cl := &cmdListener{
		etcdv3c:     c,
		name:        conf.Name,
		taskcmdpath: taskcmdpath,
		kvc:         etcdv3.NewKV(c),
		commands:    make(chan *statemachine.Message),
		mu:          &sync.Mutex{},
		stop:        make(chan bool),
	}
	ctxt := context.Background()
	go cl.watch(ctxt, taskcmdpath)
	return cl
}
func NewCommandListener ( conf * Config , task metafora . Task , c * etcdv3 . Client ) statemachine . CommandListener { taskcmdpath := path . Join ( " " , conf . Namespace , TasksPath , task . ID ( ) , CommandsPath ) cl := & cmdListener { etcdv3c : c , name : conf . Name , taskcmdpath : taskcmdpath , kvc : etcdv3 . NewKV ( c ) , commands : make ( chan * statemachine . Message ) , mu : & sync . Mutex { } , stop : make ( chan bool ) , } ctxt := context . Background ( ) go cl . watch ( ctxt , taskcmdpath ) return cl }
NewCommandListener makes a statemachine.CommandListener implementation
backed by etcd.
NewCommandListener makes a statemachine . CommandListener implementation backed by etcd .