Creates a new, empty data store. Mutations will be applied in order, starting at number 1 (number 0 can be thought of as the creation of the store).
()
| 85 | // starting at number 1 (number 0 can be thought of as the creation of the |
| 86 | // store). |
| 87 | func New() *Store { |
| 88 | ops := make(chan Op) |
| 89 | seqns := make(chan int64) |
| 90 | watches := make(chan int) |
| 91 | |
| 92 | st := &Store{ |
| 93 | Ops: ops, |
| 94 | Seqns: seqns, |
| 95 | Waiting: watches, |
| 96 | watchCh: make(chan *watch), |
| 97 | todo: new(vector.Vector), |
| 98 | watches: []*watch{}, |
| 99 | state: &state{0, emptyDir}, |
| 100 | log: map[int64]Event{}, |
| 101 | cleanCh: make(chan int64), |
| 102 | flush: make(chan bool), |
| 103 | } |
| 104 | |
| 105 | go st.process(ops, seqns, watches) |
| 106 | return st |
| 107 | } |
| 108 | |
| 109 | func split(path string) []string { |
| 110 | if path == "/" { |