[#1992] writecache: Allow to open in NOSYNC mode

Applicable only to FSTree as we cannot handle corrupted databases
properly yet.

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-10-28 13:09:38 +03:00 committed by fyrchik
parent b6930f2219
commit 98a152256b
8 changed files with 33 additions and 9 deletions

View file

@ -56,14 +56,12 @@ func (c *cache) openStore(readOnly bool) error {
}
}
c.fsTree = &fstree.FSTree{
Info: fstree.Info{
Permissions: os.ModePerm,
RootPath: c.path,
},
Depth: 1,
DirNameLen: 1,
}
c.fsTree = fstree.New(
fstree.WithPath(c.path),
fstree.WithPerm(os.ModePerm),
fstree.WithDepth(1),
fstree.WithDirNameLen(1),
fstree.WithNoSync(c.noSync))
// Write-cache can be opened multiple times during `SetMode`.
// flushed map must not be re-created in this case.