gql dir ls
This commit is contained in:
parent
6a1e338af4
commit
e576e62599
23 changed files with 1671 additions and 138 deletions
src/host/vfs
|
@ -40,9 +40,9 @@ var ArchiveFactories = map[string]FsFactory{
|
|||
|
||||
type archiveLoader func(r iio.Reader, size int64) (map[string]*archiveFile, error)
|
||||
|
||||
var _ Filesystem = &archive{}
|
||||
var _ Filesystem = &ArchiveFS{}
|
||||
|
||||
type archive struct {
|
||||
type ArchiveFS struct {
|
||||
name string
|
||||
|
||||
r iio.Reader
|
||||
|
@ -52,8 +52,8 @@ type archive struct {
|
|||
files func() (map[string]File, error)
|
||||
}
|
||||
|
||||
func NewArchive(name string, r iio.Reader, size int64, loader archiveLoader) *archive {
|
||||
return &archive{
|
||||
func NewArchive(name string, r iio.Reader, size int64, loader archiveLoader) *ArchiveFS {
|
||||
return &ArchiveFS{
|
||||
name: name,
|
||||
r: r,
|
||||
size: size,
|
||||
|
@ -94,11 +94,11 @@ func NewArchive(name string, r iio.Reader, size int64, loader archiveLoader) *ar
|
|||
}
|
||||
|
||||
// Unlink implements Filesystem.
|
||||
func (a *archive) Unlink(filename string) error {
|
||||
func (a *ArchiveFS) Unlink(filename string) error {
|
||||
return ErrNotImplemented
|
||||
}
|
||||
|
||||
func (a *archive) Open(filename string) (File, error) {
|
||||
func (a *ArchiveFS) Open(filename string) (File, error) {
|
||||
files, err := a.files()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -107,7 +107,7 @@ func (a *archive) Open(filename string) (File, error) {
|
|||
return getFile(files, filename)
|
||||
}
|
||||
|
||||
func (fs *archive) ReadDir(path string) ([]fs.DirEntry, error) {
|
||||
func (fs *ArchiveFS) ReadDir(path string) ([]fs.DirEntry, error) {
|
||||
files, err := fs.files()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -117,7 +117,7 @@ func (fs *archive) ReadDir(path string) ([]fs.DirEntry, error) {
|
|||
}
|
||||
|
||||
// Stat implements Filesystem.
|
||||
func (afs *archive) Stat(filename string) (fs.FileInfo, error) {
|
||||
func (afs *ArchiveFS) Stat(filename string) (fs.FileInfo, error) {
|
||||
files, err := afs.files()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue