mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
feat(GODT-2385): Gluon cache fallback
Update Gluon to have access to the cache fallback reader. Provide fallback reader to handle old cache file format. Remove the old logic to erase all cache files on start as the fallback option renders this irrelevant.
This commit is contained in:
@ -226,18 +226,6 @@ func run(c *cli.Context) error {
|
||||
_ = reporter.ReportMessageWithContext("Vault is corrupt", map[string]interface{}{})
|
||||
}
|
||||
|
||||
// Force re-sync if last version <= 3.0.12 due to chances in the gluon cache format.
|
||||
if lastVersion := v.GetLastVersion(); lastVersion != nil {
|
||||
versionWithLZ4Cache := semver.MustParse("3.0.13")
|
||||
if lastVersion.LessThan(versionWithLZ4Cache) {
|
||||
if err := v.ForUser(1, func(user *vault.User) error {
|
||||
return user.ClearSyncStatus()
|
||||
}); err != nil {
|
||||
logrus.WithError(err).Error("Failed to force resync on user")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !v.Migrated() {
|
||||
// Migrate old settings into the vault.
|
||||
if err := migrateOldSettings(v); err != nil {
|
||||
|
||||
@ -31,6 +31,7 @@ import (
|
||||
"github.com/ProtonMail/gluon/imap"
|
||||
"github.com/ProtonMail/gluon/reporter"
|
||||
"github.com/ProtonMail/gluon/store"
|
||||
"github.com/ProtonMail/gluon/store/fallback_v0"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/async"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/constants"
|
||||
"github.com/ProtonMail/proton-bridge/v3/internal/events"
|
||||
@ -377,6 +378,7 @@ func (*storeBuilder) New(path, userID string, passphrase []byte) (store.Store, e
|
||||
return store.NewOnDiskStore(
|
||||
filepath.Join(path, userID),
|
||||
passphrase,
|
||||
store.WithFallback(fallback_v0.NewOnDiskStoreV0WithCompressor(&fallback_v0.GZipCompressor{})),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user