dataprovider

package
v0.0.0-...-cf2fa2e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExist         = os.ErrExist
	ErrNotExist      = os.ErrNotExist
	ErrPermission    = os.ErrPermission
	ErrInvalidParent = &os.PathError{Err: errors.New("parent does not exist or not a directory")}
)

Functions

func ChMTime

func ChMTime(path string, t time.Time) error

func CreateNodes

func CreateNodes(fid string, nodes []ddrv.Node) error

func Delete

func Delete(id, parent string) error

func GetNodes

func GetNodes(fid string) ([]ddrv.Node, error)

func Load

func Load(dp DataProvider)

func Mkdir

func Mkdir(path string) error

func Mv

func Mv(name, newname string) error

func Name

func Name() string

func Rm

func Rm(path string) error

func Touch

func Touch(path string) error

func Truncate

func Truncate(fid string) error

Types

type DataProvider

type DataProvider interface {
	Name() string
	Get(id, parent string) (*File, error)
	GetChild(id string) ([]*File, error)
	Create(name, parent string, isDir bool) (*File, error)
	Update(id, parent string, file *File) (*File, error)
	Delete(id, parent string) error
	GetNodes(id string) ([]ddrv.Node, error)
	CreateNodes(id string, nodes []ddrv.Node) error
	Truncate(id string) error
	Stat(path string) (*File, error)
	Ls(path string, limit int, offset int) ([]*File, error)
	Touch(path string) error
	Mkdir(path string) error
	Rm(path string) error
	Mv(name, newname string) error
	CHTime(path string, time time.Time) error
	Close() error
}

type File

type File struct {
	Id     string        `json:"id"`
	Name   string        `json:"name" validate:"required,regex=^[\p{L}]+$"`
	Dir    bool          `json:"dir"`
	Size   int64         `json:"size,omitempty"`
	Parent ns.NullString `json:"parent,omitempty" validate:"required"`
	MTime  time.Time     `json:"mtime"`
}

func Create

func Create(name, parent string, isDir bool) (*File, error)

func Get

func Get(id, parent string) (*File, error)

func GetChild

func GetChild(id string) ([]*File, error)

func Ls

func Ls(path string, limit int, offset int) ([]*File, error)

func Stat

func Stat(path string) (*File, error)

func Update

func Update(id, parent string, file *File) (*File, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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