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:
co-authored by
Tommy van der Vorst
bt90
parent
b1c8f88a44
commit
025905fcdf
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user