переименование store => LocalStorage
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user