Chromium Code Reviews| Index: filter/txnBuf/ds.go |
| diff --git a/filter/txnBuf/ds.go b/filter/txnBuf/ds.go |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5c13ff68d25847248856b9d26e61c4a419c568cf |
| --- /dev/null |
| +++ b/filter/txnBuf/ds.go |
| @@ -0,0 +1,32 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package txnBuf |
| + |
| +import ( |
| + "golang.org/x/net/context" |
| + |
| + ds "github.com/luci/gae/service/datastore" |
| +) |
| + |
| +// 10MB is the current initial limit |
| +const transactionSizeLimit = 10 * 1000 * 1000 |
|
Vadim Sh.
2015/09/28 18:52:56
*1024*1024? :)
iannucci
2015/09/29 03:21:37
I was playing it safe. Not sure if they mean 1024
|
| + |
| +type dsBuf struct { |
| + ds.RawInterface |
| + |
| + ns string |
| +} |
| + |
| +var _ ds.RawInterface = (*dsBuf)(nil) |
| + |
| +func (d *dsBuf) RunInTransaction(f func(context.Context) error, opts *ds.TransactionOptions) error { |
| + return doRunInTransaction(d.RawInterface, f, opts) |
| +} |
| + |
| +func doRunInTransaction(base ds.RawInterface, f func(context.Context) error, opts *ds.TransactionOptions) error { |
| + return base.RunInTransaction(func(ctx context.Context) error { |
| + return withTxnBuf(ctx, f, opts) |
| + }, opts) |
| +} |