chore: switch database engine to sqlite (fixes #9954) (#9965)

Switch the database from LevelDB to SQLite, for greater stability and
simpler code.

Co-authored-by: Tommy van der Vorst <tommy@pixelspark.nl>
Co-authored-by: bt90 <btom1990@googlemail.com>
This commit is contained in:
Jakob Borg
2025-03-29 13:50:08 +01:00
committed by GitHub
co-authored by Tommy van der Vorst bt90
parent b1c8f88a44
commit 025905fcdf
146 changed files with 8315 additions and 11984 deletions
+9 -9
View File
@@ -226,20 +226,20 @@ func TestMtimeFSInsensitive(t *testing.T) {
// The mapStore is a simple database
type mapStore map[string][]byte
type mapStore map[string][2]time.Time
func (s mapStore) PutBytes(key string, data []byte) error {
s[key] = data
func (s mapStore) PutMtime(_, name string, real, virtual time.Time) error {
s[name] = [2]time.Time{real, virtual}
return nil
}
func (s mapStore) Bytes(key string) (data []byte, ok bool, err error) {
data, ok = s[key]
return
func (s mapStore) GetMtime(_, name string) (real, virtual time.Time) {
v := s[name]
return v[0], v[1]
}
func (s mapStore) Delete(key string) error {
delete(s, key)
func (s mapStore) DeleteMtime(_, name string) error {
delete(s, name)
return nil
}
@@ -260,7 +260,7 @@ func newMtimeFS(path string, db database, options ...MtimeFSOption) *mtimeFS {
}
func newMtimeFSWithWalk(path string, db database, options ...MtimeFSOption) (*mtimeFS, *walkFilesystem) {
fs := NewFilesystem(FilesystemTypeBasic, path, NewMtimeOption(db, options...))
fs := NewFilesystem(FilesystemTypeBasic, path, NewMtimeOption(db, "", options...))
wfs, _ := unwrapFilesystem(fs, filesystemWrapperTypeWalk)
mfs, _ := unwrapFilesystem(fs, filesystemWrapperTypeMtime)
return mfs.(*mtimeFS), wfs.(*walkFilesystem)