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 txnBuf | 5 package txnBuf |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "sync" | 9 "sync" |
10 | 10 |
11 "github.com/luci/gae/impl/memory" | 11 "github.com/luci/gae/impl/memory" |
12 "github.com/luci/gae/service/datastore" | 12 "github.com/luci/gae/service/datastore" |
13 "github.com/luci/gae/service/datastore/serialize" | 13 "github.com/luci/gae/service/datastore/serialize" |
14 "github.com/luci/gae/service/info" | 14 "github.com/luci/gae/service/info" |
| 15 "github.com/luci/luci-go/common/data/stringset" |
15 "github.com/luci/luci-go/common/errors" | 16 "github.com/luci/luci-go/common/errors" |
16 » "github.com/luci/luci-go/common/parallel" | 17 » "github.com/luci/luci-go/common/sync/parallel" |
17 » "github.com/luci/luci-go/common/stringset" | |
18 "golang.org/x/net/context" | 18 "golang.org/x/net/context" |
19 ) | 19 ) |
20 | 20 |
21 // DefaultSizeBudget is the size budget for the root transaction. | 21 // DefaultSizeBudget is the size budget for the root transaction. |
22 // | 22 // |
23 // Because our estimation algorithm isn't entirely correct, we take 5% off | 23 // Because our estimation algorithm isn't entirely correct, we take 5% off |
24 // the limit for encoding and estimate inaccuracies. | 24 // the limit for encoding and estimate inaccuracies. |
25 // | 25 // |
26 // 10MB taken on 2015/09/24: | 26 // 10MB taken on 2015/09/24: |
27 // https://cloud.google.com/appengine/docs/go/datastore/#Go_Quotas_and_limits | 27 // https://cloud.google.com/appengine/docs/go/datastore/#Go_Quotas_and_limits |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // plus a stringset of all the encoded root keys that `keys` represents. | 564 // plus a stringset of all the encoded root keys that `keys` represents. |
565 func toEncoded(keys []*datastore.Key) (full []string, roots stringset.Set) { | 565 func toEncoded(keys []*datastore.Key) (full []string, roots stringset.Set) { |
566 roots = stringset.New(len(keys)) | 566 roots = stringset.New(len(keys)) |
567 full = make([]string, len(keys)) | 567 full = make([]string, len(keys)) |
568 for i, k := range keys { | 568 for i, k := range keys { |
569 roots.Add(string(serialize.ToBytes(k.Root()))) | 569 roots.Add(string(serialize.ToBytes(k.Root()))) |
570 full[i] = string(serialize.ToBytes(k)) | 570 full[i] = string(serialize.ToBytes(k)) |
571 } | 571 } |
572 return | 572 return |
573 } | 573 } |
OLD | NEW |