Skip to content

Commit e92c5c6

Browse files
authored
Remove unused code in SA. (letsencrypt#4710)
Spotted by staticcheck.
1 parent 6c1af62 commit e92c5c6

File tree

3 files changed

+0
-115
lines changed

3 files changed

+0
-115
lines changed

sa/authz.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

sa/model.go

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,6 @@ type challModel struct {
183183
LockCol int64
184184
}
185185

186-
// getChallengesQuery fetches exactly the fields in challModel from the
187-
// challenges table.
188-
const getChallengesQuery = `
189-
SELECT id, authorizationID, type, status, error, token,
190-
keyAuthorization, validationRecord
191-
FROM challenges WHERE authorizationID = :authID ORDER BY id ASC`
192-
193186
// newReg creates a reg model object from a core.Registration
194187
func registrationToModel(r *core.Registration) (*regModel, error) {
195188
key, err := json.Marshal(r.Key)
@@ -253,37 +246,6 @@ func modelToRegistration(reg *regModel) (core.Registration, error) {
253246
return r, nil
254247
}
255248

256-
func challengeToModel(c *core.Challenge, authID string) (*challModel, error) {
257-
cm := challModel{
258-
AuthorizationID: authID,
259-
Type: c.Type,
260-
Status: c.Status,
261-
Token: c.Token,
262-
KeyAuthorization: c.ProvidedKeyAuthorization,
263-
}
264-
if c.Error != nil {
265-
errJSON, err := json.Marshal(c.Error)
266-
if err != nil {
267-
return nil, err
268-
}
269-
if len(errJSON) > mediumBlobSize {
270-
return nil, fmt.Errorf("Error object is too large to store in the database")
271-
}
272-
cm.Error = errJSON
273-
}
274-
if len(c.ValidationRecord) > 0 {
275-
vrJSON, err := json.Marshal(c.ValidationRecord)
276-
if err != nil {
277-
return nil, err
278-
}
279-
if len(vrJSON) > mediumBlobSize {
280-
return nil, fmt.Errorf("Validation Record object is too large to store in the database")
281-
}
282-
cm.ValidationRecord = vrJSON
283-
}
284-
return &cm, nil
285-
}
286-
287249
func modelToChallenge(cm *challModel) (core.Challenge, error) {
288250
c := core.Challenge{
289251
Type: cm.Type,

sa/sa.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
"github.com/jmhodges/clock"
1616
"github.com/prometheus/client_golang/prometheus"
17-
"gopkg.in/go-gorp/gorp.v2"
1817
jose "gopkg.in/square/go-jose.v2"
1918

2019
"github.com/letsencrypt/boulder/core"
@@ -53,12 +52,6 @@ type SQLStorageAuthority struct {
5352
rateLimitWriteErrors prometheus.Counter
5453
}
5554

56-
func digest256(data []byte) []byte {
57-
d := sha256.New()
58-
_, _ = d.Write(data) // Never returns an error
59-
return d.Sum(nil)
60-
}
61-
6255
// orderFQDNSet contains the SHA256 hash of the lowercased, comma joined names
6356
// from a new-order request, along with the corresponding orderID, the
6457
// registration ID, and the order expiry. This is used to find
@@ -71,16 +64,6 @@ type orderFQDNSet struct {
7164
Expires time.Time
7265
}
7366

74-
const (
75-
authorizationTable = "authz"
76-
pendingAuthorizationTable = "pendingAuthorizations"
77-
)
78-
79-
var authorizationTables = []string{
80-
authorizationTable,
81-
pendingAuthorizationTable,
82-
}
83-
8467
// NewSQLStorageAuthority provides persistence using a SQL backend for
8568
// Boulder. It will modify the given gorp.DbMap by adding relevant tables.
8669
func NewSQLStorageAuthority(
@@ -111,28 +94,6 @@ func NewSQLStorageAuthority(
11194
return ssa, nil
11295
}
11396

114-
func statusIsPending(status core.AcmeStatus) bool {
115-
return status == core.StatusPending || status == core.StatusProcessing || status == core.StatusUnknown
116-
}
117-
118-
func existingPending(dbMap db.OneSelector, id string) bool {
119-
var count int64
120-
_ = dbMap.SelectOne(&count, "SELECT count(*) FROM pendingAuthorizations WHERE id = :id", map[string]interface{}{"id": id})
121-
return count > 0
122-
}
123-
124-
func existingFinal(dbMap db.OneSelector, id string) bool {
125-
var count int64
126-
_ = dbMap.SelectOne(&count, "SELECT count(*) FROM authz WHERE id = :id", map[string]interface{}{"id": id})
127-
return count > 0
128-
}
129-
130-
func existingRegistration(tx *gorp.Transaction, id int64) bool {
131-
var count int64
132-
_ = tx.SelectOne(&count, "SELECT count(*) FROM registrations WHERE id = :id", map[string]interface{}{"id": id})
133-
return count > 0
134-
}
135-
13697
// GetRegistration obtains a Registration by ID
13798
func (ssa *SQLStorageAuthority) GetRegistration(ctx context.Context, id int64) (core.Registration, error) {
13899
const query = "WHERE id = ?"

0 commit comments

Comments
 (0)