Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: service/datastore/testable.go

Issue 1285703002: Add testable interface for datastore. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fixes after Raw change Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « service/datastore/serialize.go ('k') | service/taskqueue/interface.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // Panics if any of the IndexDefinition objects are not Compound()
14 AddIndexes(...*IndexDefinition)
15
16 // TakeIndexSnapshot allows you to take a snapshot of the current index
17 // tables, which can be used later with SetIndexSnapshot.
18 TakeIndexSnapshot() TestingSnapshot
19
20 // SetIndexSnapshot allows you to set the state of the current index tab les.
21 // Note that this would allow you to create 'non-lienarities' in the pre cieved
22 // index results (e.g. you could force the indexes to go back in time).
23 //
24 // SetIndexSnapshot takes a reference of the given TestingSnapshot. You' re
25 // still responsible for closing the snapshot after this call.
26 SetIndexSnapshot(TestingSnapshot)
27
28 // CatchupIndexes catches the index table up to the current state of the
29 // datastore. This is equivalent to:
30 // idxSnap := TakeIndexSnapshot()
31 // SetIndexSnapshot(idxSnap)
32 //
33 // But depending on the implementation it may implemented with an atomic
34 // operation.
35 CatchupIndexes()
36 }
OLDNEW
« no previous file with comments | « service/datastore/serialize.go ('k') | service/taskqueue/interface.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698