| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. | 1 // Copyright 2016 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 }) | 336 }) |
| 337 if err != nil { | 337 if err != nil { |
| 338 merr = append(merr, err) | 338 merr = append(merr, err) |
| 339 } else if err := datastore.Delete(c, toDelete); err != nil { | 339 } else if err := datastore.Delete(c, toDelete); err != nil { |
| 340 merr = append(merr, err) | 340 merr = append(merr, err) |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Print some stats. | 343 // Print some stats. |
| 344 processedConsoles := 0 | 344 processedConsoles := 0 |
| 345 for _, cons := range knownProjects { | 345 for _, cons := range knownProjects { |
| 346 » » processedConsoles += cons.Len() | 346 » » if cons != nil { |
| 347 » » » processedConsoles += cons.Len() |
| 348 » » } |
| 347 } | 349 } |
| 348 logging.Infof( | 350 logging.Infof( |
| 349 c, "processed %d consoles over %d projects", len(knownProjects),
processedConsoles) | 351 c, "processed %d consoles over %d projects", len(knownProjects),
processedConsoles) |
| 350 | 352 |
| 351 if len(merr) == 0 { | 353 if len(merr) == 0 { |
| 352 return nil | 354 return nil |
| 353 } | 355 } |
| 354 return merr | 356 return merr |
| 355 } | 357 } |
| 356 | 358 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 369 // GetConsole returns the requested console. | 371 // GetConsole returns the requested console. |
| 370 func GetConsole(c context.Context, proj, id string) (*Console, error) { | 372 func GetConsole(c context.Context, proj, id string) (*Console, error) { |
| 371 // TODO(hinoka): Memcache this. | 373 // TODO(hinoka): Memcache this. |
| 372 con := Console{ | 374 con := Console{ |
| 373 Parent: datastore.MakeKey(c, "Project", proj), | 375 Parent: datastore.MakeKey(c, "Project", proj), |
| 374 ID: id, | 376 ID: id, |
| 375 } | 377 } |
| 376 err := datastore.Get(c, &con) | 378 err := datastore.Get(c, &con) |
| 377 return &con, err | 379 return &con, err |
| 378 } | 380 } |
| OLD | NEW |