OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package memory | 5 package memory |
6 | 6 |
7 import ( | 7 import ( |
8 "errors" | 8 "errors" |
9 "fmt" | 9 "fmt" |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if len(idxs) == 0 { | 123 if len(idxs) == 0 { |
124 return | 124 return |
125 } | 125 } |
126 | 126 |
127 for _, i := range idxs { | 127 for _, i := range idxs { |
128 if !i.Compound() { | 128 if !i.Compound() { |
129 panic(fmt.Errorf("Attempted to add non-compound index: %
s", i)) | 129 panic(fmt.Errorf("Attempted to add non-compound index: %
s", i)) |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 » d.data.addIndexes(d.ns, idxs) | 133 » d.data.addIndexes(idxs) |
134 } | 134 } |
135 | 135 |
136 func (d *dsImpl) TakeIndexSnapshot() ds.TestingSnapshot { | 136 func (d *dsImpl) TakeIndexSnapshot() ds.TestingSnapshot { |
137 return d.data.takeSnapshot() | 137 return d.data.takeSnapshot() |
138 } | 138 } |
139 | 139 |
140 func (d *dsImpl) SetIndexSnapshot(snap ds.TestingSnapshot) { | 140 func (d *dsImpl) SetIndexSnapshot(snap ds.TestingSnapshot) { |
141 d.data.setSnapshot(snap.(*memStore)) | 141 d.data.setSnapshot(snap.(*memStore)) |
142 } | 142 } |
143 | 143 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return countQuery(fq, d.data.parent.aid, d.ns, true, d.data.snap, d.data
.snap) | 218 return countQuery(fq, d.data.parent.aid, d.ns, true, d.data.snap, d.data
.snap) |
219 } | 219 } |
220 | 220 |
221 func (*txnDsImpl) RunInTransaction(func(c context.Context) error, *ds.Transactio
nOptions) error { | 221 func (*txnDsImpl) RunInTransaction(func(c context.Context) error, *ds.Transactio
nOptions) error { |
222 return errors.New("datastore: nested transactions are not supported") | 222 return errors.New("datastore: nested transactions are not supported") |
223 } | 223 } |
224 | 224 |
225 func (*txnDsImpl) Testable() ds.Testable { | 225 func (*txnDsImpl) Testable() ds.Testable { |
226 return nil | 226 return nil |
227 } | 227 } |
OLD | NEW |