Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Commit cec60b2

Browse files
committed
GestEarliestVersion
1 parent 7c736a5 commit cec60b2

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

sc/memiavl/db.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ func (db *DB) pruneSnapshots() {
436436
}
437437

438438
// truncate Rlog until the earliest remaining snapshot
439-
earliestVersion, err := firstSnapshotVersion(db.dir)
439+
earliestVersion, err := GetEarliestVersion(db.dir)
440440
if err != nil {
441441
db.logger.Error("failed to find first snapshot", "err", err)
442442
}
@@ -771,8 +771,8 @@ func seekSnapshot(root string, targetVersion int64) (int64, error) {
771771
return snapshotVersion, nil
772772
}
773773

774-
// firstSnapshotVersion returns the earliest snapshot name in the db
775-
func firstSnapshotVersion(root string) (int64, error) {
774+
// GetEarliestVersion returns the earliest snapshot name in the db
775+
func GetEarliestVersion(root string) (int64, error) {
776776
var found int64
777777
if err := traverseSnapshots(root, true, func(version int64) (bool, error) {
778778
found = version

sc/store.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ func (cs *CommitStore) GetLatestVersion() (int64, error) {
103103
return memiavl.GetLatestVersion(cs.opts.Dir)
104104
}
105105

106+
func (cs *CommitStore) GetEarliestVersion() (int64, error) {
107+
return memiavl.GetEarliestVersion(cs.opts.Dir)
108+
}
109+
106110
func (cs *CommitStore) ApplyChangeSets(changesets []*proto.NamedChangeSet) error {
107111
return cs.db.ApplyChangeSets(changesets)
108112
}

sc/types/store.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ type Committer interface {
1515

1616
GetLatestVersion() (int64, error)
1717

18+
GetEarliestVersion() (int64, error)
19+
1820
ApplyChangeSets(cs []*proto.NamedChangeSet) error
1921

2022
ApplyUpgrades(upgrades []*proto.TreeNameUpgrade) error

0 commit comments

Comments
 (0)