forked from Silverfish/proton-bridge
GODT-2224: Allow the user to specify max sync memory usage in Vault
This commit is contained in:
@ -178,7 +178,7 @@ func (vault *Vault) SetLastVersion(version *semver.Version) error {
|
||||
})
|
||||
}
|
||||
|
||||
// GetFirstStart sets whether this is the first time the bridge has been started.
|
||||
// GetFirstStart returns whether this is the first time the bridge has been started.
|
||||
func (vault *Vault) GetFirstStart() bool {
|
||||
return vault.get().Settings.FirstStart
|
||||
}
|
||||
@ -189,3 +189,21 @@ func (vault *Vault) SetFirstStart(firstStart bool) error {
|
||||
data.Settings.FirstStart = firstStart
|
||||
})
|
||||
}
|
||||
|
||||
// GetMaxSyncMemory returns the maximum amount of memory the sync process should use.
|
||||
func (vault *Vault) GetMaxSyncMemory() uint64 {
|
||||
v := vault.get().Settings.MaxSyncMemory
|
||||
// can be zero if never written to vault before.
|
||||
if v == 0 {
|
||||
return DefaultMaxSyncMemory
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// SetMaxSyncMemory sets the maximum amount of memory the sync process should use.
|
||||
func (vault *Vault) SetMaxSyncMemory(maxMemory uint64) error {
|
||||
return vault.mod(func(data *Data) {
|
||||
data.Settings.MaxSyncMemory = maxMemory
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user