filesystemlayer

package
v0.18.6 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 6 Imported by: 1

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

type FSLDisk struct {
}

func (*FSLDisk) Create

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

func (*FSLDisk) MkdirAll

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

func (*FSLDisk) ReadFile

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

func (*FSLDisk) Remove

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

func (*FSLDisk) RemoveAll

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

func (*FSLDisk) Rename

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

func (*FSLDisk) Type

func (f *FSLDisk) Type() FSLType

func (*FSLDisk) WriteFile

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

type FSLMemory

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

func NewFSLMemory

func NewFSLMemory() *FSLMemory

func (*FSLMemory) Create

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

func (*FSLMemory) MkdirAll

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

func (*FSLMemory) ReadFile

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

func (*FSLMemory) Remove

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

func (*FSLMemory) RemoveAll

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

func (*FSLMemory) Rename

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

func (*FSLMemory) Type

func (f *FSLMemory) Type() FSLType

func (*FSLMemory) WriteFile

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

type FSLType

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
}

func FSLFactory

func FSLFactory(t FSLType) IFileSystemLayer

Jump to

Keyboard shortcuts

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