Skip to content

Commit 161bfb9

Browse files
committed
lint fixes
1 parent 30fd5d0 commit 161bfb9

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

storage/crdb/log_storage.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (m *crdbLogStorage) beginInternal(ctx context.Context, tree *trillian.Tree)
205205
}
206206
ltx.slr, ltx.readRev, err = ltx.fetchLatestRoot(ctx)
207207
if err == storage.ErrTreeNeedsInit {
208-
ltx.treeTX.writeRevision = 0
208+
ltx.writeRevision = 0
209209
return ltx, err
210210
} else if err != nil {
211211
if err := ttx.Close(); err != nil {
@@ -221,7 +221,7 @@ func (m *crdbLogStorage) beginInternal(ctx context.Context, tree *trillian.Tree)
221221
return nil, err
222222
}
223223

224-
ltx.treeTX.writeRevision = ltx.readRev + 1
224+
ltx.writeRevision = ltx.readRev + 1
225225
return ltx, nil
226226
}
227227

@@ -327,14 +327,14 @@ type logTreeTX struct {
327327

328328
// GetMerkleNodes returns the requested nodes at the read revision.
329329
func (t *logTreeTX) GetMerkleNodes(ctx context.Context, ids []compact.NodeID) ([]tree.Node, error) {
330-
t.treeTX.mu.Lock()
331-
defer t.treeTX.mu.Unlock()
330+
t.mu.Lock()
331+
defer t.mu.Unlock()
332332
return t.subtreeCache.GetNodes(ids, t.getSubtreesAtRev(ctx, t.readRev))
333333
}
334334

335335
func (t *logTreeTX) DequeueLeaves(ctx context.Context, limit int, cutoffTime time.Time) ([]*trillian.LogLeaf, error) {
336-
t.treeTX.mu.Lock()
337-
defer t.treeTX.mu.Unlock()
336+
t.mu.Lock()
337+
defer t.mu.Unlock()
338338

339339
if t.treeType == trillian.TreeType_PREORDERED_LOG {
340340
// TODO(pavelkalinnikov): Optimize this by fetching only the required
@@ -411,8 +411,8 @@ func sortLeavesForInsert(leaves []*trillian.LogLeaf) []leafAndPosition {
411411
}
412412

413413
func (t *logTreeTX) QueueLeaves(ctx context.Context, leaves []*trillian.LogLeaf, queueTimestamp time.Time) ([]*trillian.LogLeaf, error) {
414-
t.treeTX.mu.Lock()
415-
defer t.treeTX.mu.Unlock()
414+
t.mu.Lock()
415+
defer t.mu.Unlock()
416416

417417
// Don't accept batches if any of the leaves are invalid.
418418
for _, leaf := range leaves {
@@ -549,8 +549,8 @@ func (t *logTreeTX) QueueLeaves(ctx context.Context, leaves []*trillian.LogLeaf,
549549
}
550550

551551
func (t *logTreeTX) AddSequencedLeaves(ctx context.Context, leaves []*trillian.LogLeaf, timestamp time.Time) ([]*trillian.QueuedLogLeaf, error) {
552-
t.treeTX.mu.Lock()
553-
defer t.treeTX.mu.Unlock()
552+
t.mu.Lock()
553+
defer t.mu.Unlock()
554554

555555
res := make([]*trillian.QueuedLogLeaf, len(leaves))
556556
ok := status.New(codes.OK, "OK").Proto()
@@ -634,8 +634,8 @@ func (t *logTreeTX) AddSequencedLeaves(ctx context.Context, leaves []*trillian.L
634634
}
635635

636636
func (t *logTreeTX) GetLeavesByRange(ctx context.Context, start, count int64) ([]*trillian.LogLeaf, error) {
637-
t.treeTX.mu.Lock()
638-
defer t.treeTX.mu.Unlock()
637+
t.mu.Lock()
638+
defer t.mu.Unlock()
639639
return t.getLeavesByRangeInternal(ctx, start, count)
640640
}
641641

@@ -713,8 +713,8 @@ func (t *logTreeTX) getLeavesByRangeInternal(ctx context.Context, start, count i
713713
}
714714

715715
func (t *logTreeTX) GetLeavesByHash(ctx context.Context, leafHashes [][]byte, orderBySequence bool) ([]*trillian.LogLeaf, error) {
716-
t.treeTX.mu.Lock()
717-
defer t.treeTX.mu.Unlock()
716+
t.mu.Lock()
717+
defer t.mu.Unlock()
718718

719719
tmpl, err := t.ls.getLeavesByMerkleHashStmt(ctx, len(leafHashes), orderBySequence)
720720
if err != nil {
@@ -736,8 +736,8 @@ func (t *logTreeTX) getLeafDataByIdentityHash(ctx context.Context, leafHashes []
736736
}
737737

738738
func (t *logTreeTX) LatestSignedLogRoot(ctx context.Context) (*trillian.SignedLogRoot, error) {
739-
t.treeTX.mu.Lock()
740-
defer t.treeTX.mu.Unlock()
739+
t.mu.Lock()
740+
defer t.mu.Unlock()
741741

742742
if t.slr == nil {
743743
return nil, storage.ErrTreeNeedsInit
@@ -772,8 +772,8 @@ func (t *logTreeTX) fetchLatestRoot(ctx context.Context) (*trillian.SignedLogRoo
772772
}
773773

774774
func (t *logTreeTX) StoreSignedLogRoot(ctx context.Context, root *trillian.SignedLogRoot) error {
775-
t.treeTX.mu.Lock()
776-
defer t.treeTX.mu.Unlock()
775+
t.mu.Lock()
776+
defer t.mu.Unlock()
777777

778778
var logRoot types.LogRootV1
779779
if err := logRoot.UnmarshalBinary(root.LogRoot); err != nil {
@@ -791,7 +791,7 @@ func (t *logTreeTX) StoreSignedLogRoot(ctx context.Context, root *trillian.Signe
791791
logRoot.TimestampNanos,
792792
logRoot.TreeSize,
793793
logRoot.RootHash,
794-
t.treeTX.writeRevision,
794+
t.writeRevision,
795795
[]byte{})
796796
if err != nil {
797797
klog.Warningf("Failed to store signed root: %s", err)

0 commit comments

Comments
 (0)