Skip to content

Commit

Permalink
More commentary and clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchinson committed Dec 7, 2023
1 parent 7944226 commit 6b26d4e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions storage/mysql/admin_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const (
Description,
CreateTimeMillis,
UpdateTimeMillis,
PrivateKey,
PublicKey,
PrivateKey, -- Unused
PublicKey, -- Used to store StorageSettings
MaxRootDurationMillis,
Deleted,
DeleteTimeMillis
Expand Down Expand Up @@ -273,8 +273,8 @@ func (t *adminTX) CreateTree(ctx context.Context, tree *trillian.Tree) (*trillia
Description,
CreateTimeMillis,
UpdateTimeMillis,
PrivateKey,
PublicKey,
PrivateKey, -- Unused
PublicKey, -- Used to store StorageSettings
MaxRootDurationMillis)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions storage/mysql/schema/storage.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ CREATE TABLE IF NOT EXISTS Trees(
CreateTimeMillis BIGINT NOT NULL,
UpdateTimeMillis BIGINT NOT NULL,
MaxRootDurationMillis BIGINT NOT NULL,
PrivateKey MEDIUMBLOB NOT NULL,
PublicKey MEDIUMBLOB NOT NULL,
PrivateKey MEDIUMBLOB NOT NULL, -- Unused.
PublicKey MEDIUMBLOB NOT NULL, -- This is now used to store settings.
Deleted BOOLEAN,
DeleteTimeMillis BIGINT,
PRIMARY KEY(TreeId)
Expand Down
11 changes: 6 additions & 5 deletions storage/mysql/tree_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,12 @@ func (t *treeTX) storeSubtrees(ctx context.Context, subtrees []*storagepb.Subtre
// a really large number of subtrees to store.
args := make([]interface{}, 0, len(subtrees))

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

0 comments on commit 6b26d4e

Please sign in to comment.