// SubmitTask creates a new task in etcd
SubmitTask creates a new task in etcd
// SubmitTask creates a new task in etcd
func (mc *mclient) SubmitTask(task metafora.Task) error {
	c := context.Background()
	fullpath := path.Join(mc.taskPath(task.ID()), PropsPath)
	buf, err := json.Marshal(task)
	if err != nil {
		return err
	}
	txnRes, err := mc.kvc.Txn(c).
		If(etcdv3.Compare(etcdv3.Version(fullpath), "=", 0)).
		Then(etcdv3.OpPut(fullpath, string(buf)), etcdv3.OpPut(mc.taskPath(task.ID()), "")).
		Commit()
	if err != nil {
		return err
	}
	if !txnRes.Succeeded {
		return ErrFailedSubmitTask
	}
	metafora.Debugf("task %s submitted: %s", task.ID(), fullpath)
	return nil
}
func ( mc * mclient ) SubmitTask ( task metafora . Task ) error { c := context . Background ( ) fullpath := path . Join ( mc . taskPath ( task . ID ( ) ) , PropsPath ) buf , err := json . Marshal ( task ) if err != nil { return err } txnRes , err := mc . kvc . Txn ( c ) . If ( etcdv3 . Compare ( etcdv3 . Version ( fullpath ) , " " , 0 ) ) . Then ( etcdv3 . OpPut ( fullpath , string ( buf ) ) , etcdv3 . OpPut ( mc . taskPath ( task . ID ( ) ) , " " ) ) . Commit ( ) if err != nil { return err } if ! txnRes . Succeeded { return ErrFailedSubmitTask } metafora . Debugf ( " " , task . ID ( ) , fullpath ) return nil }
SubmitTask creates a new task in etcd
SubmitTask creates a new task in etcd
// Should we create both of these?