OLD | NEW |
(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 txnBuf |
| 6 |
| 7 import ( |
| 8 "golang.org/x/net/context" |
| 9 |
| 10 ds "github.com/luci/gae/service/datastore" |
| 11 ) |
| 12 |
| 13 // 10MB is the current initial limit |
| 14 const transactionSizeLimit = 10 * 1000 * 1000 |
| 15 |
| 16 type dsBuf struct { |
| 17 ds.RawInterface |
| 18 |
| 19 ns string |
| 20 } |
| 21 |
| 22 var _ ds.RawInterface = (*dsBuf)(nil) |
| 23 |
| 24 func (d *dsBuf) RunInTransaction(f func(context.Context) error, opts *ds.Transac
tionOptions) error { |
| 25 return doRunInTransaction(d.RawInterface, f, opts) |
| 26 } |
| 27 |
| 28 func doRunInTransaction(base ds.RawInterface, f func(context.Context) error, opt
s *ds.TransactionOptions) error { |
| 29 return base.RunInTransaction(func(ctx context.Context) error { |
| 30 return withTxnBuf(ctx, f, opts) |
| 31 }, opts) |
| 32 } |
OLD | NEW |