fs

package
v0.0.0-...-c70c80c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const GET_FILES_BY_DIR = "GET_FILES_BY_DIR"
View Source
const INSERT_FILE = "INSERT_FILE"

Variables

View Source
var (
	FSDir            = "fs"
	HeadersDir       = path.Join(FSDir, "headers")
	DataDir          = path.Join(FSDir, "data")
	ConfigPath       = path.Join(FSDir, "config.conf")
	ErrExists        = "ErrExist: filesystem already exists in %s"
	DefaultGroupName = safe.GroupName("usr") // default group name

	GET_GROUP_NAME = "GET_GROUP_NAME" // query to get group name
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Quota       int64
	Description string
}

type CreateOptions

type CreateOptions struct {
	Quota       int64  // Quota is the maximum size of the filesystem in bytes
	Overwrite   bool   // Overwrite is whether to overwrite the filesystem if it already exists
	Description string // Description is a human-readable description of the filesystem
}

type FS

type FS struct {
	S        *safe.Safe
	StoreUrl string
	Config   Config
}

func CreateFS

func CreateFS(c *safe.Safe, options CreateOptions) (*FS, error)

func Open

func Open(S *safe.Safe) (*FS, error)

func (*FS) GetData

func (f *FS) GetData(path string, options GetOptions) ([]byte, error)

func (*FS) GetFile

func (f *FS) GetFile(path, dest string, options GetOptions) ([]byte, error)

func (*FS) List

func (f *FS) List(dir string, options ListOptions) ([]File, error)

func (*FS) PutData

func (fs *FS) PutData(dest string, src []byte, options PutOptions) error

func (*FS) PutFile

func (fs *FS) PutFile(dest string, src string, options PutOptions) error

func (*FS) PutStream

func (fs *FS) PutStream(dest string, src io.ReadSeekCloser, options PutOptions) error

type File

type File struct {
	Id            string
	Dir           string
	Name          string
	GroupName     safe.GroupName
	Creator       security.UserId
	Size          int
	ModTime       time.Time
	Tags          core.Set[string]
	Attributes    map[string]any
	LocalPath     string
	EncryptionKey []byte
}

func (File) Path

func (f File) Path() string

type FileWrap

type FileWrap struct {
	Group        safe.GroupName
	EncryptionId int
	Data         []byte
}

type GetOptions

type GetOptions struct {
	Async chan string
}

type ListOptions

type ListOptions struct {
	After   time.Time // After is the minimum modification time of files to list
	Before  time.Time // Before is the maximum modification time of files to list
	OrderBy string    // OrderBy is the list of fields to order by in SQL style
	Reverse bool      // Reverse is whether to reverse the order of files
	Limit   int       // Limit is the maximum number of files to list
	Offset  int       // Offset is the number of files to skip
	Prefix  string    // Prefix is a filter on the prefix of the name
	Suffix  string    // Suffix is a filter on the suffix of the name
	Tag     string    // Tag is a filter on the tag of the file
}

type PutOptions

type PutOptions struct {
	Async      chan map[string]error
	GroupName  safe.GroupName
	Tags       core.Set[string]
	Attributes map[string]any
}

Jump to

Keyboard shortcuts

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