Skip to content

Commit

Permalink
🎨 Support manual purge of unreferenced data snapshots in the S3/WebDA…
Browse files Browse the repository at this point in the history
…V cloud storage siyuan-note/siyuan#10081
  • Loading branch information
88250 committed Jan 14, 2024
1 parent 0fc06c8 commit 951de73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (repo *Repo) PurgeCloud() (ret *entity.PurgeStat, err error) {
return
}

err = repo.purgeIndexesV2(unreferencedIndexIDs)
err = repo.purgeIndexesV2(refIndexIDs)
if nil != err {
logging.LogErrorf("purge indexes-v2.json failed: %s", err)
return
Expand All @@ -309,7 +309,7 @@ func (repo *Repo) PurgeCloud() (ret *entity.PurgeStat, err error) {
return
}

func (repo *Repo) purgeIndexesV2(unreferencedIndexIDs map[string]bool) (err error) {
func (repo *Repo) purgeIndexesV2(refIndexIDs map[string]bool) (err error) {
data, err := repo.cloud.DownloadObject("indexes-v2.json")
if nil != err {
if !errors.Is(err, cloud.ErrCloudObjectNotFound) {
Expand All @@ -333,7 +333,7 @@ func (repo *Repo) purgeIndexesV2(unreferencedIndexIDs map[string]bool) (err erro

var tmp []*cloud.Index
for _, index := range indexes.Indexes {
if !unreferencedIndexIDs[index.ID] {
if refIndexIDs[index.ID] {
tmp = append(tmp, index)
}
}
Expand Down

0 comments on commit 951de73

Please sign in to comment.