Esempio n. 1
0
File: ns.go Progetto: zenoss/rog-go
func (f *NsFile) Walk(elem ...string) (*NsFile, error) {
	seq, results := seq.NewSequencer()
	go func() {
		<-results // Walk
		_, ok := <-results
		if ok {
			panic("expected closed")
		}
	}()
	f = f.SeqWalk(seq, elem...)
	seq.Do(nil, nil)
	if err := seq.Wait(); err != nil {
		return nil, err
	}
	return f, nil
}
Esempio n. 2
0
File: ns.go Progetto: zenoss/rog-go
func (f *NsFile) ops(ops ...seq.Req) ([]seq.Result, error) {
	c := make(chan OpResults)
	seq, replies := seq.NewSequencer()
	go func() {
		r, ok := <-replies
		if !ok {
			c <- nil
		}
		_, ok = <-replies
		if ok {
			panic("expected closed")
		}
		c <- r.(OpResults)
	}()
	f.seqops(seq, ops...)
	seq.Do(nil, nil)
	r := <-c
	return r, seq.Wait()
}