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

Unified Diff: impl/memory/taskqueue_data.go

Issue 1302813003: impl/memory: Implement Queries (Closed) Base URL: https://github.com/luci/gae.git@add_multi_iterator
Patch Set: stringSet everywhere Created 5 years, 4 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 | « impl/memory/stringset.go ('k') | impl/memory/testing_utils_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/taskqueue_data.go
diff --git a/impl/memory/taskqueue_data.go b/impl/memory/taskqueue_data.go
index 4bc24a1a7436a074e6b3071393818ef83146b426..4fca8d3655d74785489c49d05a6c0b71a2efc520 100644
--- a/impl/memory/taskqueue_data.go
+++ b/impl/memory/taskqueue_data.go
@@ -127,7 +127,7 @@ func (t *taskQueueData) purgeLocked(queueName string) error {
return nil
}
-var tqOkMethods = map[string]struct{}{
+var tqOkMethods = stringSet{
"GET": {},
"POST": {},
"HEAD": {},
@@ -152,7 +152,7 @@ func (t *taskQueueData) prepTask(c context.Context, ns string, task *tq.Task, qu
if toSched.Method == "" {
toSched.Method = "POST"
}
- if _, ok := tqOkMethods[toSched.Method]; !ok {
+ if !tqOkMethods.has(toSched.Method) {
return nil, fmt.Errorf("taskqueue: bad method %q", toSched.Method)
}
if toSched.Method != "POST" && toSched.Method != "PUT" {
@@ -196,9 +196,14 @@ var _ interface {
tq.Testable
} = (*txnTaskQueueData)(nil)
-func (t *txnTaskQueueData) canApplyTxn(obj memContextObj) bool { return false }
-func (t *txnTaskQueueData) applyTxn(context.Context, memContextObj) { panic("impossible") }
-func (t *txnTaskQueueData) mkTxn(*ds.TransactionOptions) memContextObj { panic("impossible") }
+func (t *txnTaskQueueData) canApplyTxn(obj memContextObj) bool { return false }
+func (t *txnTaskQueueData) applyTxn(context.Context, memContextObj) {
+ impossible(fmt.Errorf("cannot apply nested transaction"))
+}
+func (t *txnTaskQueueData) mkTxn(*ds.TransactionOptions) memContextObj {
+ impossible(fmt.Errorf("cannot start nested transaction"))
+ return nil
+}
func (t *txnTaskQueueData) endTxn() {
if atomic.LoadInt32(&t.closed) == 1 {
« no previous file with comments | « impl/memory/stringset.go ('k') | impl/memory/testing_utils_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698