OLD | NEW |
1 package local_db | 1 package local_db |
2 | 2 |
3 import ( | 3 import ( |
4 "bytes" | 4 "bytes" |
5 "encoding/binary" | 5 "encoding/binary" |
6 "encoding/gob" | 6 "encoding/gob" |
7 "fmt" | 7 "fmt" |
8 "net/http" | 8 "net/http" |
9 "sort" | 9 "sort" |
10 "strconv" | 10 "strconv" |
11 "strings" | 11 "strings" |
12 "sync" | 12 "sync" |
13 "time" | 13 "time" |
14 | 14 |
15 "github.com/boltdb/bolt" | 15 "github.com/boltdb/bolt" |
16 "github.com/gorilla/mux" | 16 "github.com/gorilla/mux" |
17 "github.com/skia-dev/glog" | 17 "github.com/skia-dev/glog" |
18 "go.skia.org/infra/build_scheduler/go/db" | |
19 "go.skia.org/infra/go/boltutil" | 18 "go.skia.org/infra/go/boltutil" |
20 "go.skia.org/infra/go/httputils" | 19 "go.skia.org/infra/go/httputils" |
21 "go.skia.org/infra/go/metrics2" | 20 "go.skia.org/infra/go/metrics2" |
22 "go.skia.org/infra/go/util" | 21 "go.skia.org/infra/go/util" |
| 22 "go.skia.org/infra/task_scheduler/go/db" |
23 ) | 23 ) |
24 | 24 |
25 const ( | 25 const ( |
26 // BUCKET_TASKS is the name of the Tasks bucket. Key is Task.Id, which i
s set | 26 // BUCKET_TASKS is the name of the Tasks bucket. Key is Task.Id, which i
s set |
27 // to (creation time, sequence number) (see formatId for detail), value
is | 27 // to (creation time, sequence number) (see formatId for detail), value
is |
28 // described in docs for BUCKET_TASKS_VERSION. Tasks will be updated in
place. | 28 // described in docs for BUCKET_TASKS_VERSION. Tasks will be updated in
place. |
29 // All repos share the same bucket. | 29 // All repos share the same bucket. |
30 BUCKET_TASKS = "tasks" | 30 BUCKET_TASKS = "tasks" |
31 // BUCKET_TASKS_FILL_PERCENT is the value to set for bolt.Bucket.FillPer
cent | 31 // BUCKET_TASKS_FILL_PERCENT is the value to set for bolt.Bucket.FillPer
cent |
32 // for BUCKET_TASKS. BUCKET_TASKS will be append-mostly, so use a high f
ill | 32 // for BUCKET_TASKS. BUCKET_TASKS will be append-mostly, so use a high f
ill |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 _, err := tx.WriteTo(w) | 520 _, err := tx.WriteTo(w) |
521 return err | 521 return err |
522 }); err != nil { | 522 }); err != nil { |
523 glog.Errorf("Failed to create DB backup: %s", err) | 523 glog.Errorf("Failed to create DB backup: %s", err) |
524 httputils.ReportError(w, r, err, "Failed to create DB ba
ckup") | 524 httputils.ReportError(w, r, err, "Failed to create DB ba
ckup") |
525 } | 525 } |
526 }) | 526 }) |
527 http.Handle("/", httputils.LoggingGzipRequestResponse(r)) | 527 http.Handle("/", httputils.LoggingGzipRequestResponse(r)) |
528 return http.ListenAndServe(port, nil) | 528 return http.ListenAndServe(port, nil) |
529 } | 529 } |
OLD | NEW |