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

Side by Side Diff: filter/txnBuf/state.go

Issue 1916463004: impl/memory: Disallow empty namespace. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rbase. Created 4 years, 8 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/dscache/context.go ('k') | impl/dummy/dummy.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 txnBuf 5 package txnBuf
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "sync" 9 "sync"
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // a negative delta if the parent transaction had many large entities wh ich 116 // a negative delta if the parent transaction had many large entities wh ich
117 // the inner transaction deleted. 117 // the inner transaction deleted.
118 sizeBudget int64 118 sizeBudget int64
119 // countBudget is the number of entity writes that this transaction has to 119 // countBudget is the number of entity writes that this transaction has to
120 // operate in. 120 // operate in.
121 writeCountBudget int 121 writeCountBudget int
122 } 122 }
123 123
124 func withTxnBuf(ctx context.Context, cb func(context.Context) error, opts *datas tore.TransactionOptions) error { 124 func withTxnBuf(ctx context.Context, cb func(context.Context) error, opts *datas tore.TransactionOptions) error {
125 inf := info.Get(ctx) 125 inf := info.Get(ctx)
126 » ns := inf.GetNamespace() 126 » ns, _ := inf.GetNamespace()
127 127
128 parentState, _ := ctx.Value(dsTxnBufParent).(*txnBufState) 128 parentState, _ := ctx.Value(dsTxnBufParent).(*txnBufState)
129 roots := stringset.New(0) 129 roots := stringset.New(0)
130 rootLimit := 1 130 rootLimit := 1
131 if opts != nil && opts.XG { 131 if opts != nil && opts.XG {
132 rootLimit = XGTransactionGroupLimit 132 rootLimit = XGTransactionGroupLimit
133 } 133 }
134 sizeBudget, writeCountBudget := DefaultSizeBudget, DefaultWriteCountBudg et 134 sizeBudget, writeCountBudget := DefaultSizeBudget, DefaultWriteCountBudg et
135 if parentState != nil { 135 if parentState != nil {
136 // TODO(riannucci): this is a bit wonky since it means that a ch ild 136 // TODO(riannucci): this is a bit wonky since it means that a ch ild
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 // plus a stringset of all the encoded root keys that `keys` represents. 547 // plus a stringset of all the encoded root keys that `keys` represents.
548 func toEncoded(keys []*datastore.Key) (full []string, roots stringset.Set) { 548 func toEncoded(keys []*datastore.Key) (full []string, roots stringset.Set) {
549 roots = stringset.New(len(keys)) 549 roots = stringset.New(len(keys))
550 full = make([]string, len(keys)) 550 full = make([]string, len(keys))
551 for i, k := range keys { 551 for i, k := range keys {
552 roots.Add(string(serialize.ToBytes(k.Root()))) 552 roots.Add(string(serialize.ToBytes(k.Root())))
553 full[i] = string(serialize.ToBytes(k)) 553 full[i] = string(serialize.ToBytes(k))
554 } 554 }
555 return 555 return
556 } 556 }
OLDNEW
« no previous file with comments | « filter/dscache/context.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698