feat(GODT-2829): Integrate new sync service

Update imap service to use the new sync service.

The new sync state is stored as simple file on disk to avoid contention
with concurrent vault writes.
This commit is contained in:
Leander Beernaert
2023-08-25 15:03:41 +02:00
parent aa77a67a1c
commit efbe84964f
27 changed files with 864 additions and 1176 deletions

View File

@ -41,6 +41,7 @@ import (
"github.com/ProtonMail/proton-bridge/v3/internal/safe"
"github.com/ProtonMail/proton-bridge/v3/internal/sentry"
"github.com/ProtonMail/proton-bridge/v3/internal/services/imapsmtpserver"
"github.com/ProtonMail/proton-bridge/v3/internal/services/syncservice"
"github.com/ProtonMail/proton-bridge/v3/internal/telemetry"
"github.com/ProtonMail/proton-bridge/v3/internal/user"
"github.com/ProtonMail/proton-bridge/v3/internal/vault"
@ -127,6 +128,7 @@ type Bridge struct {
goHeartbeat func()
serverManager *imapsmtpserver.Service
syncService *syncservice.Service
}
// New creates a new bridge.
@ -268,7 +270,8 @@ func newBridge(
firstStart: firstStart,
lastVersion: lastVersion,
tasks: tasks,
tasks: tasks,
syncService: syncservice.NewService(reporter, panicHandler),
}
bridge.serverManager = imapsmtpserver.NewService(context.Background(),
@ -285,6 +288,8 @@ func newBridge(
return nil, err
}
bridge.syncService.Run(bridge.tasks)
return bridge, nil
}