framework: occupy

@fengjingchao This works. need some refactoring. 
Did not make myself clear. My question is how node/task get host/port?
Xiaoyun
2014年11月24日 下午3:18于 "Xiang Li" <notifications@github.com>写道：

> In framework.go:
>
> > @@ -368,3 +369,26 @@ func (f *framework) GetLogger() log.Logger {
> >  func (f *framework) GetTaskID() uint64 {
> >  	return f.taskID
> >  }
> > +
> > +func (f *framework) occupyTask(taskPath string) uint64 {
> > +	slots, err := f.etcdClient.Get(taskPath, true, true)
> > +	if err != nil {
> > +		// TODO: handle err
> > +		log.Panic(err)
> > +	}
> > +	for _, s := range slots.Node.Nodes {
> > +		_, err := f.etcdClient.CompareAndSwap(s.Key+"/master", f.ln.Addr().String(), 0, "empty", 0)
>
> @xiaoyunwu <https://github.com/xiaoyunwu>
> i put the host:port to the slot directly for now.
> we need to add another layer of abstraction for node.
> the plan is:
> 1. add node layer into framework. so framework knows its own node info
> 2. framework creates node under /app/node/{id} with node info
> 3. framework save nodeid into the task instead of host:port.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/go-distributed/meritop/pull/52/files#r20775256>.
>