Index: filter/txnBuf/ds.go |
diff --git a/filter/txnBuf/ds.go b/filter/txnBuf/ds.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..593211697c5c0b78e0ab112751b371e20f94a4e2 |
--- /dev/null |
+++ b/filter/txnBuf/ds.go |
@@ -0,0 +1,29 @@ |
+// 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" |
+) |
+ |
+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) |
+} |