fs

package
v0.0.0-...-761d37c Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID      int `sql:"id"`
	Path    string
	Data    []byte
	Backing int
	Time    int64 `sql:"time"`
	// contains filtered or unexported fields
}

func (*Entry) Close

func (e *Entry) Close() error

func (Entry) Info

func (e Entry) Info() (fs.FileInfo, error)

func (Entry) IsDir

func (e Entry) IsDir() bool

func (Entry) ModTime

func (e Entry) ModTime() time.Time

func (Entry) Mode

func (e Entry) Mode() fs.FileMode

func (Entry) Name

func (e Entry) Name() string

func (*Entry) Read

func (e *Entry) Read(b []byte) (int, error)

func (Entry) Size

func (e Entry) Size() int64

func (Entry) Stat

func (e Entry) Stat() (fs.FileInfo, error)

func (Entry) Sys

func (e Entry) Sys() interface{}

func (Entry) Type

func (e Entry) Type() fs.FileMode

type FSOption

type FSOption func(o *option) error

func WithDBFile

func WithDBFile(path string) FSOption

type Filesystem

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

func New

func New(root string, opts ...FSOption) (*Filesystem, error)

func (*Filesystem) Add

func (f *Filesystem) Add(name string) (int, error)

Add indexes a disk-backed file into the in-memory filesystem. Subsequent operations on disk-backed files pass through to the underlying os.File implementation.

func (*Filesystem) AddVirtual

func (f *Filesystem) AddVirtual(name string, data []byte) (int, error)

AddVirtual creates a virtual in-memory entry for a virtual file. Flush must be called to persist this virtual file to disk. It may be operated on by while in memory.

func (*Filesystem) Conn

func (f *Filesystem) Conn() *sqlx.DB

Conn returns the underlying database connection to execute arbitrary SQL

func (*Filesystem) Flush

func (f *Filesystem) Flush() error

Flush writes all virtual files to disk

func (*Filesystem) Open

func (f *Filesystem) Open(name string) (fs.File, error)

Open returns an fs.File or a fs.PathError if the file does not exist

func (*Filesystem) ReadDir

func (f *Filesystem) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir returns all directory entries or a PathError

func (*Filesystem) ReadFile

func (f *Filesystem) ReadFile(name string) ([]byte, error)

ReadFile returns the file contents or a PathError

Jump to

Keyboard shortcuts

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