Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package datastore | |
| 6 | |
| 7 type TestingSnapshot interface{} | |
| 8 | |
| 9 // Testable is the testable interface for fake datastore implementations. | |
| 10 type Testable interface { | |
| 11 // AddIndex adds the provided index. | |
| 12 // Blocks all datastore access while the index is built. | |
| 13 AddIndexes(...*IndexDefinition) | |
|
dnj (Google)
2015/08/14 22:53:54
Should mention that this an panic if a non-compoun
iannucci
2015/08/15 01:59:25
it's for testing, so I'd rather have it panic if t
| |
| 14 | |
| 15 // TakeIndexSnapshot allows you to take a snapshot of the current index | |
| 16 // tables, which can be used later with SetIndexSnapshot. | |
| 17 TakeIndexSnapshot() TestingSnapshot | |
| 18 | |
| 19 // SetIndexSnapshot allows you to set the state of the current index tab les. | |
| 20 // Note that this would allow you to create 'non-lienarities' in the pre cieved | |
| 21 // index results (e.g. you could force the indexes to go back in time). | |
| 22 // | |
| 23 // SetIndexSnapshot takes a reference of the given TestingSnapshot. You' re | |
| 24 // still responsible for closing the snapshot after this call. | |
| 25 SetIndexSnapshot(TestingSnapshot) | |
| 26 | |
| 27 // CatchupIndexes catches the index table up to the current state of the | |
| 28 // datastore. This is equivalent to: | |
| 29 // idxSnap := TakeIndexSnapshot() | |
| 30 // SetIndexSnapshot(idxSnap) | |
| 31 // | |
| 32 // But depending on the implementation it may implemented with an atomic | |
| 33 // operation. | |
| 34 CatchupIndexes() | |
| 35 } | |
| OLD | NEW |