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

Unified Diff: go/src/infra/gae/libs/gae/memory/raw_datstore_data.go

Issue 1227203004: Convert 'Testable' interface into an optional filter. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@add_filters
Patch Set: final rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/gae/libs/gae/memory/raw_datstore.go ('k') | go/src/infra/gae/libs/gae/memory/taskqueue.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/gae/libs/gae/memory/raw_datstore_data.go
diff --git a/go/src/infra/gae/libs/gae/memory/raw_datstore_data.go b/go/src/infra/gae/libs/gae/memory/raw_datstore_data.go
index 9af0dae2671e967a837f23f73d425dd0fd133a04..70533f693668bb993c045f5495bd708b4e76cc5a 100644
--- a/go/src/infra/gae/libs/gae/memory/raw_datstore_data.go
+++ b/go/src/infra/gae/libs/gae/memory/raw_datstore_data.go
@@ -19,8 +19,6 @@ import (
//////////////////////////////// dataStoreData /////////////////////////////////
type dataStoreData struct {
- gae.BrokenFeatures
-
rwlock sync.RWMutex
// See README.md for store schema.
store *memStore
@@ -30,15 +28,13 @@ type dataStoreData struct {
var (
_ = memContextObj((*dataStoreData)(nil))
_ = sync.Locker((*dataStoreData)(nil))
- _ = gae.Testable((*dataStoreData)(nil))
)
func newDataStoreData() *dataStoreData {
store := newMemStore()
return &dataStoreData{
- BrokenFeatures: gae.BrokenFeatures{DefaultError: errors.New("INTERNAL_ERROR")},
- store: store,
- snap: store.Snapshot(), // empty but better than a nil pointer.
+ store: store,
+ snap: store.Snapshot(), // empty but better than a nil pointer.
}
}
@@ -294,11 +290,10 @@ func (d *dataStoreData) mkTxn(o *gae.DSTransactionOptions) (memContextObj, error
return &txnDataStoreData{
// alias to the main datastore's so that testing code can have primitive
// access to break features inside of transactions.
- BrokenFeatures: &d.BrokenFeatures,
- parent: d,
- isXG: o != nil && o.XG,
- snap: d.store.Snapshot(),
- muts: map[string][]txnMutation{},
+ parent: d,
+ isXG: o != nil && o.XG,
+ snap: d.store.Snapshot(),
+ muts: map[string][]txnMutation{},
}, nil
}
@@ -312,7 +307,6 @@ type txnMutation struct {
}
type txnDataStoreData struct {
- *gae.BrokenFeatures
sync.Mutex
parent *dataStoreData
@@ -329,11 +323,7 @@ type txnDataStoreData struct {
// length of encoded keys + values.
}
-var (
- _ = memContextObj((*txnDataStoreData)(nil))
- _ = sync.Locker((*txnDataStoreData)(nil))
- _ = gae.Testable((*txnDataStoreData)(nil))
-)
+var _ memContextObj = (*txnDataStoreData)(nil)
const xgEGLimit = 25
@@ -351,13 +341,13 @@ func (*txnDataStoreData) mkTxn(*gae.DSTransactionOptions) (memContextObj, error)
return nil, errors.New("datastore: nested transactions are not supported")
}
-func (td *txnDataStoreData) RunIfNotBroken(f func() error) error {
+func (td *txnDataStoreData) isBroken() error {
// Slightly different from the SDK... datastore and taskqueue each implement
// this here, where in the SDK only datastore.transaction.Call does.
if atomic.LoadInt32(&td.closed) == 1 {
return errors.New("datastore: transaction context has expired")
}
- return td.BrokenFeatures.RunIfNotBroken(f)
+ return nil
}
// writeMutation ensures that this transaction can support the given key/value
« no previous file with comments | « go/src/infra/gae/libs/gae/memory/raw_datstore.go ('k') | go/src/infra/gae/libs/gae/memory/taskqueue.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698