filesystemlayer

package
v0.27.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("naza filesystemlayer: not found")

Functions

This section is empty.

Types

type FslDisk added in v0.19.0

type FslDisk struct {
}

func (*FslDisk) Create added in v0.19.0

func (f *FslDisk) Create(name string) (IFile, error)

func (*FslDisk) MkdirAll added in v0.19.0

func (f *FslDisk) MkdirAll(path string, perm uint32) error

func (*FslDisk) ReadFile added in v0.19.0

func (f *FslDisk) ReadFile(filename string) ([]byte, error)

func (*FslDisk) Remove added in v0.19.0

func (f *FslDisk) Remove(name string) error

func (*FslDisk) RemoveAll added in v0.19.0

func (f *FslDisk) RemoveAll(path string) error

func (*FslDisk) Rename added in v0.19.0

func (f *FslDisk) Rename(oldpath string, newpath string) error

func (*FslDisk) Type added in v0.19.0

func (f *FslDisk) Type() FslType

func (*FslDisk) WriteFile added in v0.19.0

func (f *FslDisk) WriteFile(filename string, data []byte, perm uint32) error

type FslMemory added in v0.19.0

type FslMemory struct {
	// contains filtered or unexported fields
}

func NewFslMemory added in v0.19.0

func NewFslMemory() *FslMemory

func (*FslMemory) Create added in v0.19.0

func (f *FslMemory) Create(name string) (IFile, error)

func (*FslMemory) MkdirAll added in v0.19.0

func (f *FslMemory) MkdirAll(path string, perm uint32) error

func (*FslMemory) ReadFile added in v0.19.0

func (f *FslMemory) ReadFile(filename string) ([]byte, error)

func (*FslMemory) Remove added in v0.19.0

func (f *FslMemory) Remove(name string) error

func (*FslMemory) RemoveAll added in v0.19.0

func (f *FslMemory) RemoveAll(path string) error

func (*FslMemory) Rename added in v0.19.0

func (f *FslMemory) Rename(oldpath string, newpath string) error

func (*FslMemory) Type added in v0.19.0

func (f *FslMemory) Type() FslType

func (*FslMemory) WriteFile added in v0.19.0

func (f *FslMemory) WriteFile(filename string, data []byte, perm uint32) error

type FslType added in v0.19.0

type FslType int
const (
	FslTypeDisk   FslType = 1
	FslTypeMemory         = 2
)

type IFile

type IFile interface {
	Write(b []byte) (n int, err error)
	Close() error
}

type IFileSystemLayer

type IFileSystemLayer interface {
	Type() FslType

	// 创建文件
	// 原始语义:如果文件已经存在,原文件内容被清空
	Create(name string) (IFile, error)

	Rename(oldpath string, newpath string) error
	MkdirAll(path string, perm uint32) error
	Remove(name string) error
	RemoveAll(path string) error

	ReadFile(filename string) ([]byte, error)
	WriteFile(filename string, data []byte, perm uint32) error
}
var (
	DefaultDiskFileSystemLayer   IFileSystemLayer
	DefaultMemoryFileSystemLayer IFileSystemLayer
)

func FslFactory added in v0.19.0

func FslFactory(t FslType) IFileSystemLayer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL