Skip to content

Commit a39550f

Browse files
committed
Remove some context assumptions
1 parent 2b8c3f8 commit a39550f

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

db/multi.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ func (mi *MultiInserter) query() (string, []interface{}) {
102102
}
103103

104104
// Insert inserts all the collected rows into the database represented by
105-
// `queryer`. `queryer` is assumed to already have a context attached. If a
106-
// non-empty returningColumn was provided, then it returns the list of values
107-
// from that column returned by the query.
105+
// `queryer`. If a non-empty returningColumn was provided, then it returns
106+
// the list of values from that column returned by the query.
108107
func (mi *MultiInserter) Insert(ctx context.Context, queryer Queryer) ([]int64, error) {
109108
query, queryArgs := mi.query()
110109
rows, err := queryer.QueryContext(ctx, query, queryArgs...)

sa/model.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,7 @@ var blockedKeysColumns = "keyHash, added, source, comment"
10021002
// - If all of the order's authorizations are valid, and we haven't begun
10031003
// processing, then the order is status ready.
10041004
//
1005-
// An error is returned for any other case. It assumes that the provided
1006-
// database selector already has a context associated with it.
1005+
// An error is returned for any other case.
10071006
func statusForOrder(ctx context.Context, s db.Selector, order *corepb.Order, now time.Time) (string, error) {
10081007
// Without any further work we know an order with an error is invalid
10091008
if order.Error != nil {
@@ -1119,8 +1118,7 @@ type authzValidity struct {
11191118
}
11201119

11211120
// getAuthorizationStatuses takes a sequence of authz IDs, and returns the
1122-
// status and expiration date of each of them. It assumes that the provided
1123-
// database selector already has a context associated with it.
1121+
// status and expiration date of each of them.
11241122
func getAuthorizationStatuses(ctx context.Context, s db.Selector, ids []int64) ([]authzValidity, error) {
11251123
var params []interface{}
11261124
for _, id := range ids {
@@ -1151,8 +1149,7 @@ func getAuthorizationStatuses(ctx context.Context, s db.Selector, ids []int64) (
11511149
return allAuthzValidity, nil
11521150
}
11531151

1154-
// authzForOrder retrieves the authorization IDs for an order. It assumes that
1155-
// the provided database selector already has a context associated with it.
1152+
// authzForOrder retrieves the authorization IDs for an order.
11561153
func authzForOrder(ctx context.Context, s db.Selector, orderID int64) ([]int64, error) {
11571154
var v2IDs []int64
11581155
_, err := s.Select(
@@ -1165,8 +1162,7 @@ func authzForOrder(ctx context.Context, s db.Selector, orderID int64) ([]int64,
11651162
}
11661163

11671164
// namesForOrder finds all of the requested names associated with an order. The
1168-
// names are returned in their reversed form (see `sa.ReverseName`). It assumes
1169-
// that the provided database selector already has a context associated with it.
1165+
// names are returned in their reversed form (see `sa.ReverseName`).
11701166
func namesForOrder(ctx context.Context, s db.Selector, orderID int64) ([]string, error) {
11711167
var reversedNames []string
11721168
_, err := s.Select(

sa/rate_limits.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ func baseDomain(name string) string {
3030

3131
// addCertificatesPerName adds 1 to the rate limit count for the provided
3232
// domains, in a specific time bucket. It must be executed in a transaction, and
33-
// the input timeToTheHour must be a time rounded to an hour. It assumes that
34-
// the given db already has a context associated with it.
33+
// the input timeToTheHour must be a time rounded to an hour.
3534
func (ssa *SQLStorageAuthority) addCertificatesPerName(ctx context.Context, db db.SelectExecer, names []string, timeToTheHour time.Time) error {
3635
// De-duplicate the base domains.
3736
baseDomainsMap := make(map[string]bool)
@@ -57,8 +56,7 @@ func (ssa *SQLStorageAuthority) addCertificatesPerName(ctx context.Context, db d
5756
}
5857

5958
// countCertificates returns the count of certificates issued for a domain's
60-
// eTLD+1 (aka base domain), during a given time range. It assumes that the
61-
// given db already has a context associated with it.
59+
// eTLD+1 (aka base domain), during a given time range.
6260
func (ssa *SQLStorageAuthorityRO) countCertificates(ctx context.Context, dbMap db.Selector, domain string, timeRange *sapb.Range) (int64, time.Time, error) {
6361
latest := time.Unix(0, timeRange.Latest)
6462
var results []struct {
@@ -102,8 +100,7 @@ func (ssa *SQLStorageAuthorityRO) countCertificates(ctx context.Context, dbMap d
102100

103101
// addNewOrdersRateLimit adds 1 to the rate limit count for the provided ID, in
104102
// a specific time bucket. It must be executed in a transaction, and the input
105-
// timeToTheMinute must be a time rounded to a minute. It assumes that the given
106-
// db already has a context associated with it.
103+
// timeToTheMinute must be a time rounded to a minute.
107104
func addNewOrdersRateLimit(ctx context.Context, dbMap db.SelectExecer, regID int64, timeToTheMinute time.Time) error {
108105
_, err := dbMap.ExecContext(ctx, `INSERT INTO newOrdersRL
109106
(regID, time, count)
@@ -119,8 +116,7 @@ func addNewOrdersRateLimit(ctx context.Context, dbMap db.SelectExecer, regID int
119116
}
120117

121118
// countNewOrders returns the count of orders created in the given time range
122-
// for the given registration ID. It assumes that the given db already has a
123-
// context associated with it.
119+
// for the given registration ID.
124120
func countNewOrders(ctx context.Context, dbMap db.Selector, req *sapb.CountOrdersRequest) (*sapb.Count, error) {
125121
var counts []int64
126122
_, err := dbMap.Select(

0 commit comments

Comments
 (0)