Skip to content

Commit 260ccff

Browse files
committed
More commentary and clarification
1 parent c5bff06 commit 260ccff

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

storage/mysql/admin_storage.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ const (
5151
Description,
5252
CreateTimeMillis,
5353
UpdateTimeMillis,
54-
PrivateKey,
55-
PublicKey,
54+
PrivateKey, -- Unused
55+
PublicKey, -- Used to store StorageSettings
5656
MaxRootDurationMillis,
5757
Deleted,
5858
DeleteTimeMillis
@@ -273,8 +273,8 @@ func (t *adminTX) CreateTree(ctx context.Context, tree *trillian.Tree) (*trillia
273273
Description,
274274
CreateTimeMillis,
275275
UpdateTimeMillis,
276-
PrivateKey,
277-
PublicKey,
276+
PrivateKey, -- Unused
277+
PublicKey, -- Used to store StorageSettings
278278
MaxRootDurationMillis)
279279
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
280280
if err != nil {

storage/mysql/schema/storage.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ CREATE TABLE IF NOT EXISTS Trees(
1818
CreateTimeMillis BIGINT NOT NULL,
1919
UpdateTimeMillis BIGINT NOT NULL,
2020
MaxRootDurationMillis BIGINT NOT NULL,
21-
PrivateKey MEDIUMBLOB NOT NULL,
22-
PublicKey MEDIUMBLOB NOT NULL,
21+
PrivateKey MEDIUMBLOB NOT NULL, -- Unused.
22+
PublicKey MEDIUMBLOB NOT NULL, -- This is now used to store settings.
2323
Deleted BOOLEAN,
2424
DeleteTimeMillis BIGINT,
2525
PRIMARY KEY(TreeId)

storage/mysql/tree_storage.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,12 @@ func (t *treeTX) storeSubtrees(ctx context.Context, subtrees []*storagepb.Subtre
318318
// a really large number of subtrees to store.
319319
args := make([]interface{}, 0, len(subtrees))
320320

321-
subtreeRev := t.writeRevision
322-
if !t.subtreeRevs {
323-
// If we aren't doing subtree revisions then always fill in the subtree
324-
// revision with a constant, such as 0.
325-
subtreeRev = 0
321+
// If not using subtree revisions then default value of 0 is fine. There is no
322+
// significance to this value, other than it cannot be NULL in the DB.
323+
var subtreeRev int64
324+
if t.subtreeRevs {
325+
// We're using subtree revisions, so ensure we write at the correct revision
326+
subtreeRev = t.writeRevision
326327
}
327328
for _, s := range subtrees {
328329
s := s

0 commit comments

Comments
 (0)