| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package memory | 5 package memory |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "regexp" | 8 "regexp" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 if err != nil { | 98 if err != nil { |
| 99 return err | 99 return err |
| 100 } | 100 } |
| 101 | 101 |
| 102 for _, task := range tasks { | 102 for _, task := range tasks { |
| 103 cb(t.deleteLocked(task, queueName)) | 103 cb(t.deleteLocked(task, queueName)) |
| 104 } | 104 } |
| 105 return nil | 105 return nil |
| 106 } | 106 } |
| 107 | 107 |
| 108 func (t *taskqueueImpl) Lease(maxTasks int, queueName string, leaseTime int) ([]
*tq.Task, error) { |
| 109 panic("not implemented yet") |
| 110 } |
| 111 |
| 112 func (t *taskqueueImpl) LeaseByTag(maxTasks int, queueName string, leaseTime int
, tag string) ([]*tq.Task, error) { |
| 113 panic("not implemented yet") |
| 114 } |
| 115 |
| 116 func (t *taskqueueImpl) ModifyLease(task *tq.Task, queueName string, leaseTime i
nt) error { |
| 117 panic("not implemented yet") |
| 118 } |
| 119 |
| 108 func (t *taskqueueImpl) Purge(queueName string) error { | 120 func (t *taskqueueImpl) Purge(queueName string) error { |
| 109 t.Lock() | 121 t.Lock() |
| 110 defer t.Unlock() | 122 defer t.Unlock() |
| 111 | 123 |
| 112 return t.purgeLocked(queueName) | 124 return t.purgeLocked(queueName) |
| 113 } | 125 } |
| 114 | 126 |
| 115 func (t *taskqueueImpl) Stats(queueNames []string, cb tq.RawStatsCB) error { | 127 func (t *taskqueueImpl) Stats(queueNames []string, cb tq.RawStatsCB) error { |
| 116 t.Lock() | 128 t.Lock() |
| 117 defer t.Unlock() | 129 defer t.Unlock() |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 for _, task := range tasks { | 213 for _, task := range tasks { |
| 202 cb(t.addLocked(task, queueName)) | 214 cb(t.addLocked(task, queueName)) |
| 203 } | 215 } |
| 204 return nil | 216 return nil |
| 205 } | 217 } |
| 206 | 218 |
| 207 func (t *taskqueueTxnImpl) DeleteMulti([]*tq.Task, string, tq.RawCB) error { | 219 func (t *taskqueueTxnImpl) DeleteMulti([]*tq.Task, string, tq.RawCB) error { |
| 208 return errors.New("taskqueue: cannot DeleteMulti from a transaction") | 220 return errors.New("taskqueue: cannot DeleteMulti from a transaction") |
| 209 } | 221 } |
| 210 | 222 |
| 223 func (t *taskqueueTxnImpl) Lease(maxTasks int, queueName string, leaseTime int)
([]*tq.Task, error) { |
| 224 return nil, errors.New("taskqueue: cannot Lease from a transaction") |
| 225 } |
| 226 |
| 227 func (t *taskqueueTxnImpl) LeaseByTag(maxTasks int, queueName string, leaseTime
int, tag string) ([]*tq.Task, error) { |
| 228 return nil, errors.New("taskqueue: cannot LeaseByTag from a transaction"
) |
| 229 } |
| 230 |
| 231 func (t *taskqueueTxnImpl) ModifyLease(task *tq.Task, queueName string, leaseTim
e int) error { |
| 232 return errors.New("taskqueue: cannot ModifyLease from a transaction") |
| 233 } |
| 234 |
| 211 func (t *taskqueueTxnImpl) Purge(string) error { | 235 func (t *taskqueueTxnImpl) Purge(string) error { |
| 212 return errors.New("taskqueue: cannot Purge from a transaction") | 236 return errors.New("taskqueue: cannot Purge from a transaction") |
| 213 } | 237 } |
| 214 | 238 |
| 215 func (t *taskqueueTxnImpl) Stats([]string, tq.RawStatsCB) error { | 239 func (t *taskqueueTxnImpl) Stats([]string, tq.RawStatsCB) error { |
| 216 return errors.New("taskqueue: cannot Stats from a transaction") | 240 return errors.New("taskqueue: cannot Stats from a transaction") |
| 217 } | 241 } |
| 218 | 242 |
| 219 func (t *taskqueueTxnImpl) GetTestable() tq.Testable { return t } | 243 func (t *taskqueueTxnImpl) GetTestable() tq.Testable { return t } |
| 220 | 244 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 240 func dupQueue(q tq.QueueData) tq.QueueData { | 264 func dupQueue(q tq.QueueData) tq.QueueData { |
| 241 r := make(tq.QueueData, len(q)) | 265 r := make(tq.QueueData, len(q)) |
| 242 for k, q := range q { | 266 for k, q := range q { |
| 243 r[k] = make(map[string]*tq.Task, len(q)) | 267 r[k] = make(map[string]*tq.Task, len(q)) |
| 244 for tn, t := range q { | 268 for tn, t := range q { |
| 245 r[k][tn] = t.Duplicate() | 269 r[k][tn] = t.Duplicate() |
| 246 } | 270 } |
| 247 } | 271 } |
| 248 return r | 272 return r |
| 249 } | 273 } |
| OLD | NEW |