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

Side by Side Diff: impl/memory/gkvlite_utils.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: appease errcheck Created 5 years, 3 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 | « impl/memory/datastore_test.go ('k') | impl/memory/memcache.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "bytes" 8 "bytes"
9 "runtime" 9 "runtime"
10 "sync" 10 "sync"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 // memStore is a gkvlite.Store which will panic for anything which might 63 // memStore is a gkvlite.Store which will panic for anything which might
64 // otherwise return an error. 64 // otherwise return an error.
65 // 65 //
66 // This is reasonable for in-memory Store objects, since the only errors that 66 // This is reasonable for in-memory Store objects, since the only errors that
67 // should occur happen with file IO on the underlying file (which of course 67 // should occur happen with file IO on the underlying file (which of course
68 // doesn't exist). 68 // doesn't exist).
69 type memStore gkvlite.Store 69 type memStore gkvlite.Store
70 70
71 func (memStore) ImATestingSnapshot() {}
72
71 func newMemStore() *memStore { 73 func newMemStore() *memStore {
72 ret, err := gkvlite.NewStore(nil) 74 ret, err := gkvlite.NewStore(nil)
73 memoryCorruption(err) 75 memoryCorruption(err)
74 return (*memStore)(ret) 76 return (*memStore)(ret)
75 } 77 }
76 78
77 func (ms *memStore) Snapshot() *memStore { 79 func (ms *memStore) Snapshot() *memStore {
78 ret := (*memStore)((*gkvlite.Store)(ms).Snapshot()) 80 ret := (*memStore)((*gkvlite.Store)(ms).Snapshot())
79 runtime.SetFinalizer((*gkvlite.Store)(ret), func(s *gkvlite.Store) { 81 runtime.SetFinalizer((*gkvlite.Store)(ret), func(s *gkvlite.Store) {
80 go s.Close() 82 go s.Close()
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 func (mc *memCollection) VisitItemsAscend(target []byte, withValue bool, visitor gkvlite.ItemVisitor) { 134 func (mc *memCollection) VisitItemsAscend(target []byte, withValue bool, visitor gkvlite.ItemVisitor) {
133 err := (*gkvlite.Collection)(mc).VisitItemsAscend(target, withValue, vis itor) 135 err := (*gkvlite.Collection)(mc).VisitItemsAscend(target, withValue, vis itor)
134 memoryCorruption(err) 136 memoryCorruption(err)
135 } 137 }
136 138
137 func (mc *memCollection) GetTotals() (numItems, numBytes uint64) { 139 func (mc *memCollection) GetTotals() (numItems, numBytes uint64) {
138 numItems, numBytes, err := (*gkvlite.Collection)(mc).GetTotals() 140 numItems, numBytes, err := (*gkvlite.Collection)(mc).GetTotals()
139 memoryCorruption(err) 141 memoryCorruption(err)
140 return 142 return
141 } 143 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_test.go ('k') | impl/memory/memcache.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698