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

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

Issue 1309803004: Add transaction buffer filter. (Closed) Base URL: https://github.com/luci/gae.git@add_query_support
Patch Set: Make tests faster, no lock for queries Created 5 years, 2 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 | « filter/txnBuf/txnbuf_test.go ('k') | no next file » | 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 "fmt" 9 "fmt"
10 "sync" 10 "sync"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 d.rwlock.RLock() 119 d.rwlock.RLock()
120 defer d.rwlock.RUnlock() 120 defer d.rwlock.RUnlock()
121 return d.disableSpecialEntities 121 return d.disableSpecialEntities
122 } 122 }
123 123
124 func (d *dataStoreData) getQuerySnaps(consistent bool) (idx, head *memStore) { 124 func (d *dataStoreData) getQuerySnaps(consistent bool) (idx, head *memStore) {
125 d.rwlock.RLock() 125 d.rwlock.RLock()
126 defer d.rwlock.RUnlock() 126 defer d.rwlock.RUnlock()
127 if d.snap == nil { 127 if d.snap == nil {
128 // we're 'always consistent' 128 // we're 'always consistent'
129 » » return d.head, d.head 129 » » snap := d.head.Snapshot()
130 » » return snap, snap
iannucci 2015/09/30 03:03:31 This was really dumb on my part. `d.head` is the c
130 } 131 }
131 132
132 head = d.head.Snapshot() 133 head = d.head.Snapshot()
133 if consistent { 134 if consistent {
134 idx = head 135 idx = head
135 } else { 136 } else {
136 idx = d.snap 137 idx = d.snap
137 } 138 }
138 return 139 return
139 } 140 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 550 }
550 551
551 func keyBytes(key *ds.Key) []byte { 552 func keyBytes(key *ds.Key) []byte {
552 return serialize.ToBytes(ds.MkProperty(key)) 553 return serialize.ToBytes(ds.MkProperty(key))
553 } 554 }
554 555
555 func rpm(data []byte) (ds.PropertyMap, error) { 556 func rpm(data []byte) (ds.PropertyMap, error) {
556 return serialize.ReadPropertyMap(bytes.NewBuffer(data), 557 return serialize.ReadPropertyMap(bytes.NewBuffer(data),
557 serialize.WithContext, "", "") 558 serialize.WithContext, "", "")
558 } 559 }
OLDNEW
« no previous file with comments | « filter/txnBuf/txnbuf_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698