переименование store => LocalStorage

This commit is contained in:
S.Solodyagin
2025-10-28 12:11:41 +03:00
parent 5704693c7e
commit 42298fe1e3
3 changed files with 28 additions and 27 deletions
+9 -7
View File
@@ -10,7 +10,7 @@ import (
var _ http.FileSystem = (*HttpFS)(nil)
type HttpFS struct {
store *Store
localStorage *LocalStorage
remoteStorage remote.Storage
}
@@ -25,12 +25,13 @@ func WithRemoteStorage(storage remote.Storage) HttpFSOption {
// NewHttpFS
func NewHttpFS(dir string, opts ...HttpFSOption) (*HttpFS, error) {
store, err := NewStore(dir)
localStorage, err := NewLocalStorage(dir)
if err != nil {
return nil, err
}
f := &HttpFS{store: store}
f := &HttpFS{}
f.localStorage = localStorage
for _, opt := range opts {
if opt != nil {
@@ -49,10 +50,11 @@ func (f *HttpFS) Open(name string) (http.File, error) {
return f.remoteStorage.Open(name)
}
return f.store.Open(n)
return f.localStorage.Open(n)
}
// LocalStorage
func (f *HttpFS) LocalStorage() *LocalStorage { return f.localStorage }
// RemoteStorage
func (f *HttpFS) RemoteStorage() remote.Storage {
return f.remoteStorage
}
func (f *HttpFS) RemoteStorage() remote.Storage { return f.remoteStorage }