Skip to content

Commit c433565

Browse files
committed
different fetcher functions + update dep
1 parent f2b7fb7 commit c433565

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/prometheus/client_golang v1.20.5
1515
github.com/rs/cors v1.11.1
1616
github.com/transparency-dev/formats v0.0.0-20240909113624-7ce4ea605e8b
17-
github.com/transparency-dev/trillian-tessera v0.0.0-20240911103714-727b99dc32a7
17+
github.com/transparency-dev/trillian-tessera v0.0.0-20241111165037-f123aedf7aed
1818
go.etcd.io/bbolt v1.3.11
1919
golang.org/x/crypto v0.29.0
2020
golang.org/x/mod v0.22.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,8 @@ github.com/transparency-dev/merkle v0.0.2 h1:Q9nBoQcZcgPamMkGn7ghV8XiTZ/kRxn1yCG
969969
github.com/transparency-dev/merkle v0.0.2/go.mod h1:pqSy+OXefQ1EDUVmAJ8MUhHB9TXGuzVAT58PqBoHz1A=
970970
github.com/transparency-dev/trillian-tessera v0.0.0-20240911103714-727b99dc32a7 h1:8Wg8K8HO2Srmfsk94J2mIADbwhFjL3Bp+OqHJObnYuY=
971971
github.com/transparency-dev/trillian-tessera v0.0.0-20240911103714-727b99dc32a7/go.mod h1:90QYeyW+bGY0wtDrlfrGU8F/N1h7r+3CAZtVgkQZcqE=
972+
github.com/transparency-dev/trillian-tessera v0.0.0-20241111165037-f123aedf7aed h1:aTMg++8gf/gWYxRPSKVthreHoWwW9hEiF2z2RgCdDlY=
973+
github.com/transparency-dev/trillian-tessera v0.0.0-20241111165037-f123aedf7aed/go.mod h1:rY8XWy8NMtSnwxIJnDquXmv404GhPOKXkg+De5aBat8=
972974
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
973975
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
974976
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

modules/dedup/dedup.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"strconv"
2525
"time"
2626

27-
"github.com/transparency-dev/trillian-tessera/api/layout"
2827
"github.com/transparency-dev/trillian-tessera/client"
2928
"k8s.io/klog/v2"
3029
)
@@ -50,24 +49,24 @@ type LocalBEDedupStorage interface {
5049
type ParseBundleFunc func([]byte, uint64) ([]LeafIdx, error)
5150

5251
// UpdateFromLog synchronises a local best effort deduplication storage with a log.
53-
func UpdateFromLog(ctx context.Context, lds LocalBEDedupStorage, t time.Duration, f client.Fetcher, pb ParseBundleFunc) {
52+
func UpdateFromLog(ctx context.Context, lds LocalBEDedupStorage, t time.Duration, fcp client.CheckpointFetcherFunc, fb client.EntryBundleFetcherFunc, pb ParseBundleFunc) {
5453
tck := time.NewTicker(t)
5554
defer tck.Stop()
5655
for {
5756
select {
5857
case <-ctx.Done():
5958
return
6059
case <-tck.C:
61-
if err := sync(ctx, lds, pb, f); err != nil {
60+
if err := sync(ctx, lds, pb, fcp, fb); err != nil {
6261
klog.Warningf("error updating deduplication data: %v", err)
6362
}
6463
}
6564
}
6665
}
6766

6867
// sync synchronises a deduplication storage with the corresponding log content.
69-
func sync(ctx context.Context, lds LocalBEDedupStorage, pb ParseBundleFunc, f client.Fetcher) error {
70-
cpRaw, err := f(ctx, layout.CheckpointPath)
68+
func sync(ctx context.Context, lds LocalBEDedupStorage, pb ParseBundleFunc, fcp client.CheckpointFetcherFunc, fb client.EntryBundleFetcherFunc) error {
69+
cpRaw, err := fcp(ctx)
7170
if err != nil {
7271
return fmt.Errorf("error fetching checkpoint: %v", err)
7372
}
@@ -91,8 +90,7 @@ func sync(ctx context.Context, lds LocalBEDedupStorage, pb ParseBundleFunc, f cl
9190
if ckptSize > oldSize {
9291
klog.V(2).Infof("LocalBEDEdup.sync(): log at size %d, dedup database at size %d, startig to sync", ckptSize, oldSize)
9392
for i := oldSize / 256; i <= ckptSize/256; i++ {
94-
p := fmt.Sprintf("tile/data/%s", layout.NWithSuffix(0, i, ckptSize))
95-
eRaw, err := f(ctx, p)
93+
eRaw, err := fb(ctx, ckptSize, i)
9694
if err != nil {
9795
if errors.Is(err, os.ErrNotExist) {
9896
return fmt.Errorf("leaf bundle at index %d not found: %v", i, err)

0 commit comments

Comments
 (0)