op

package
v3.17.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WORK     = "work"
	DISABLED = "disabled"
	RootName = "root"
)

Variables

This section is empty.

Functions

func Cancel2FAById added in v3.7.1

func Cancel2FAById(id uint) error

func Cancel2FAByUser added in v3.7.1

func Cancel2FAByUser(u *model.User) error

func ClearCache

func ClearCache(storage driver.Driver, path string)

func Copy

func Copy(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string, lazyCache ...bool) error

Copy Just copy file[s] in a storage

func CreateMeta added in v3.7.1

func CreateMeta(u *model.Meta) error

func CreateStorage

func CreateStorage(ctx context.Context, storage model.Storage) (uint, error)

CreateStorage Save the storage to database so storage can get an id then instantiate corresponding driver and save it in memory

func CreateUser added in v3.7.1

func CreateUser(u *model.User) error

func DeleteMetaById added in v3.7.1

func DeleteMetaById(id uint) error

func DeleteSettingItemByKey added in v3.7.1

func DeleteSettingItemByKey(key string) error

func DeleteStorageById

func DeleteStorageById(ctx context.Context, id uint) error

func DeleteUserById added in v3.7.1

func DeleteUserById(id uint) error

func DisableStorage

func DisableStorage(ctx context.Context, id uint) error

func EnableStorage

func EnableStorage(ctx context.Context, id uint) error

func Get

func Get(ctx context.Context, storage driver.Driver, path string) (model.Obj, error)

Get object from list of files

func GetAdmin added in v3.7.1

func GetAdmin() (*model.User, error)

func GetAllStorages added in v3.7.1

func GetAllStorages() []driver.Driver

func GetBalancedStorage

func GetBalancedStorage(path string) driver.Driver

GetBalancedStorage get storage by path

func GetDriverInfoMap

func GetDriverInfoMap() map[string]driver.Info

func GetDriverNames

func GetDriverNames() []string

func GetGuest added in v3.7.1

func GetGuest() (*model.User, error)

func GetMetaById added in v3.7.1

func GetMetaById(id uint) (*model.Meta, error)

func GetMetaByPath added in v3.7.1

func GetMetaByPath(path string) (*model.Meta, error)

func GetMetas added in v3.7.1

func GetMetas(pageIndex, pageSize int) (metas []model.Meta, count int64, err error)

func GetNearestMeta added in v3.7.1

func GetNearestMeta(path string) (*model.Meta, error)

func GetPublicSettingItems added in v3.7.1

func GetPublicSettingItems() ([]model.SettingItem, error)

func GetPublicSettingsMap added in v3.7.1

func GetPublicSettingsMap() map[string]string

func GetSettingItemByKey added in v3.7.1

func GetSettingItemByKey(key string) (*model.SettingItem, error)

func GetSettingItemInKeys added in v3.7.1

func GetSettingItemInKeys(keys []string) ([]model.SettingItem, error)

func GetSettingItems added in v3.7.1

func GetSettingItems() ([]model.SettingItem, error)

func GetSettingItemsByGroup added in v3.7.1

func GetSettingItemsByGroup(group int) ([]model.SettingItem, error)

func GetSettingItemsInGroups added in v3.7.1

func GetSettingItemsInGroups(groups []int) ([]model.SettingItem, error)

func GetSettingsMap added in v3.7.1

func GetSettingsMap() map[string]string

func GetStorageAndActualPath

func GetStorageAndActualPath(rawPath string) (storage driver.Driver, actualPath string, err error)

GetStorageAndActualPath Get the corresponding storage and actual path for path: remove the mount path prefix and join the actual root folder if exists

func GetStorageByMountPath added in v3.7.1

func GetStorageByMountPath(mountPath string) (driver.Driver, error)

func GetStorageVirtualFilesByPath

func GetStorageVirtualFilesByPath(prefix string) []model.Obj

GetStorageVirtualFilesByPath Obtain the virtual file generated by the storage according to the path for example, there are: /a/b,/a/c,/a/d/e,/a/b.balance1,/av GetStorageVirtualFilesByPath(/a) => b,c,d

func GetUnwrap added in v3.7.1

func GetUnwrap(ctx context.Context, storage driver.Driver, path string) (model.Obj, error)

func GetUserById added in v3.7.1

func GetUserById(id uint) (*model.User, error)

func GetUserByName added in v3.7.1

func GetUserByName(username string) (*model.User, error)

func GetUserByRole added in v3.7.1

func GetUserByRole(role int) (*model.User, error)

func GetUsers added in v3.7.1

func GetUsers(pageIndex, pageSize int) (users []model.User, count int64, err error)

func HandleObjsUpdateHook added in v3.7.1

func HandleObjsUpdateHook(parent string, objs []model.Obj)

func HandleSettingItemHook added in v3.7.1

func HandleSettingItemHook(item *model.SettingItem) (hasHook bool, err error)

func HasStorage added in v3.7.1

func HasStorage(mountPath string) bool

func Key

func Key(storage driver.Driver, path string) string
func Link(ctx context.Context, storage driver.Driver, path string, args model.LinkArgs) (*model.Link, model.Obj, error)

Link get link, if is an url. should have an expiry time

func List

func List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs, refresh ...bool) ([]model.Obj, error)

List files in storage, not contains virtual file

func LoadStorage

func LoadStorage(ctx context.Context, storage model.Storage) error

LoadStorage load exist storage in db to memory

func MakeDir

func MakeDir(ctx context.Context, storage driver.Driver, path string, lazyCache ...bool) error

func Move

func Move(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string, lazyCache ...bool) error

func MustSaveDriverStorage

func MustSaveDriverStorage(driver driver.Driver)

MustSaveDriverStorage call from specific driver

func Other

func Other(ctx context.Context, storage driver.Driver, args model.FsOtherArgs) (interface{}, error)

Other api

func Put

func Put(ctx context.Context, storage driver.Driver, dstDirPath string, file *model.FileStream, up driver.UpdateProgress, lazyCache ...bool) error

func RegisterDriver

func RegisterDriver(driver New)

func RegisterObjsUpdateHook added in v3.6.0

func RegisterObjsUpdateHook(hook ObjsUpdateHook)

func RegisterSettingItemHook added in v3.7.1

func RegisterSettingItemHook(key string, hook SettingItemHook)

func RegisterStorageHook added in v3.7.1

func RegisterStorageHook(hook StorageHook)

func Remove

func Remove(ctx context.Context, storage driver.Driver, path string) error

func Rename

func Rename(ctx context.Context, storage driver.Driver, srcPath, dstName string, lazyCache ...bool) error

func SaveSettingItem added in v3.7.1

func SaveSettingItem(item *model.SettingItem) (err error)

func SaveSettingItems added in v3.7.1

func SaveSettingItems(items []model.SettingItem) error

func UpdateMeta added in v3.7.1

func UpdateMeta(u *model.Meta) error

func UpdateStorage

func UpdateStorage(ctx context.Context, storage model.Storage) error

UpdateStorage update storage get old storage first drop the storage then reinitialize

func UpdateUser added in v3.7.1

func UpdateUser(u *model.User) error

Types

type New

type New func() driver.Driver

func GetDriverNew

func GetDriverNew(name string) (New, error)

type ObjsUpdateHook added in v3.6.0

type ObjsUpdateHook = func(parent string, objs []model.Obj)

Obj

type SettingItemHook added in v3.7.1

type SettingItemHook func(item *model.SettingItem) error

Setting

type StorageHook added in v3.7.1

type StorageHook func(typ string, storage driver.Driver)

Storage

Jump to

Keyboard shortcuts

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