Documentation
¶
Index ¶
- Constants
- func ArchiveDecompress(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string, ...) error
- func ArchiveGet(ctx context.Context, storage driver.Driver, path string, ...) (model.Obj, model.Obj, error)
- func Cancel2FAById(id uint) error
- func Cancel2FAByUser(u *model.User) error
- func ClearCache(storage driver.Driver, path string)
- func Copy(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string, ...) error
- func CreateLabelFileBinDing(req CreateLabelFileBinDingReq, userId uint) error
- func CreateMeta(u *model.Meta) error
- func CreateRole(r *model.Role) error
- func CreateSSHPublicKey(k *model.SSHPublicKey) (error, bool)
- func CreateStorage(ctx context.Context, storage model.Storage) (uint, error)
- func CreateUser(u *model.User) error
- func DelUserCache(username string) error
- func DeleteLabelById(ctx context.Context, id, userId uint) error
- func DeleteMetaById(id uint) error
- func DeleteRole(id uint) error
- func DeleteSSHPublicKeyById(keyId uint) error
- func DeleteSettingItemByKey(key string) error
- func DeleteStorageById(ctx context.Context, id uint) error
- func DeleteUserById(id uint) error
- func DisableStorage(ctx context.Context, id uint) error
- func DriverExtract(ctx context.Context, storage driver.Driver, path string, ...) (*model.Link, model.Obj, error)
- func EnableStorage(ctx context.Context, id uint) error
- func Get(ctx context.Context, storage driver.Driver, path string) (model.Obj, error)
- func GetAdmin() (*model.User, error)
- func GetAllStorages() []driver.Driver
- func GetArchiveMeta(ctx context.Context, storage driver.Driver, path string, ...) (*model.ArchiveMetaProvider, error)
- func GetArchiveToolAndStream(ctx context.Context, storage driver.Driver, path string, args model.LinkArgs) (model.Obj, tool.Tool, []*stream.SeekableStream, error)
- func GetBalancedStorage(path string) driver.Driver
- func GetDriverInfoMap() map[string]driver.Info
- func GetDriverNames() []string
- func GetGuest() (*model.User, error)
- func GetLabelByFileName(userId uint, fileName string) ([]model.Label, error)
- func GetMetaById(id uint) (*model.Meta, error)
- func GetMetaByPath(path string) (*model.Meta, error)
- func GetMetas(pageIndex, pageSize int) (metas []model.Meta, count int64, err error)
- func GetNearestMeta(path string) (*model.Meta, error)
- func GetPublicSettingItems() ([]model.SettingItem, error)
- func GetPublicSettingsMap() map[string]string
- func GetRole(id uint) (*model.Role, error)
- func GetRoleByName(name string) (*model.Role, error)
- func GetRoles(pageIndex, pageSize int) ([]model.Role, int64, error)
- func GetRolesByUserID(userID uint) ([]model.Role, error)
- func GetSSHPublicKeyByIdAndUserId(id uint, userId uint) (*model.SSHPublicKey, error)
- func GetSSHPublicKeyByUserId(userId uint, pageIndex, pageSize int) (keys []model.SSHPublicKey, count int64, err error)
- func GetSettingItemByKey(key string) (*model.SettingItem, error)
- func GetSettingItemInKeys(keys []string) ([]model.SettingItem, error)
- func GetSettingItems() ([]model.SettingItem, error)
- func GetSettingItemsByGroup(group int) ([]model.SettingItem, error)
- func GetSettingItemsInGroups(groups []int) ([]model.SettingItem, error)
- func GetSettingsMap() map[string]string
- func GetStorageAndActualPath(rawPath string) (storage driver.Driver, actualPath string, err error)
- func GetStorageByMountPath(mountPath string) (driver.Driver, error)
- func GetStorageVirtualFilesByPath(prefix string) []model.Obj
- func GetUnwrap(ctx context.Context, storage driver.Driver, path string) (model.Obj, error)
- func GetUserById(id uint) (*model.User, error)
- func GetUserByName(username string) (*model.User, error)
- func GetUserByRole(role int) (*model.User, error)
- func GetUsers(pageIndex, pageSize int) (users []model.User, count int64, err error)
- func HandleObjsUpdateHook(parent string, objs []model.Obj)
- func HandleSettingItemHook(item *model.SettingItem) (hasHook bool, err error)
- func HasStorage(mountPath string) bool
- func InternalExtract(ctx context.Context, storage driver.Driver, path string, ...) (io.ReadCloser, int64, error)
- 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)
- func List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs) ([]model.Obj, error)
- func ListArchive(ctx context.Context, storage driver.Driver, path string, ...) ([]model.Obj, error)
- func LoadStorage(ctx context.Context, storage model.Storage) error
- func MakeDir(ctx context.Context, storage driver.Driver, path string, lazyCache ...bool) error
- func Move(ctx context.Context, storage driver.Driver, srcPath, dstDirPath string, ...) error
- func MustSaveDriverStorage(driver driver.Driver)
- func Other(ctx context.Context, storage driver.Driver, args model.FsOtherArgs) (interface{}, error)
- func Put(ctx context.Context, storage driver.Driver, dstDirPath string, ...) error
- func PutURL(ctx context.Context, storage driver.Driver, dstDirPath, dstName, url string, ...) error
- func RegisterDriver(driver DriverConstructor)
- func RegisterObjsUpdateHook(hook ObjsUpdateHook)
- func RegisterSettingChangingCallback(f func())
- func RegisterSettingItemHook(key string, hook SettingItemHook)
- func RegisterStorageHook(hook StorageHook)
- func Remove(ctx context.Context, storage driver.Driver, path string) error
- func Rename(ctx context.Context, storage driver.Driver, srcPath, dstName string, ...) error
- func SaveSettingItem(item *model.SettingItem) (err error)
- func SaveSettingItems(items []model.SettingItem) error
- func SettingCacheUpdate()
- func StringSliceToUintSlice(strSlice []string) ([]uint, error)
- func UpdateMeta(u *model.Meta) error
- func UpdateRole(r *model.Role) error
- func UpdateSSHPublicKey(k *model.SSHPublicKey) error
- func UpdateStorage(ctx context.Context, storage model.Storage) error
- func UpdateUser(u *model.User) error
- type CreateLabelFileBinDingReq
- type DriverConstructor
- type ObjLabelResp
- type ObjsUpdateHook
- type SettingItemHook
- type StorageHook
Constants ¶
const ( WORK = "work" DISABLED = "disabled" RootName = "root" )
Variables ¶
This section is empty.
Functions ¶
func ArchiveDecompress ¶ added in v3.42.0
func ArchiveGet ¶ added in v3.42.0
func Cancel2FAById ¶ added in v3.7.1
func Cancel2FAByUser ¶ added in v3.7.1
func ClearCache ¶
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 CreateLabelFileBinDing ¶ added in v3.46.0
func CreateLabelFileBinDing(req CreateLabelFileBinDingReq, userId uint) error
func CreateMeta ¶ added in v3.7.1
func CreateRole ¶ added in v3.46.0
func CreateSSHPublicKey ¶ added in v3.42.0
func CreateSSHPublicKey(k *model.SSHPublicKey) (error, bool)
func CreateStorage ¶
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 DelUserCache ¶ added in v3.25.0
func DeleteLabelById ¶ added in v3.46.0
func DeleteMetaById ¶ added in v3.7.1
func DeleteRole ¶ added in v3.46.0
func DeleteSSHPublicKeyById ¶ added in v3.42.0
func DeleteSettingItemByKey ¶ added in v3.7.1
func DeleteUserById ¶ added in v3.7.1
func DriverExtract ¶ added in v3.42.0
func GetAllStorages ¶ added in v3.7.1
func GetArchiveMeta ¶ added in v3.42.0
func GetArchiveMeta(ctx context.Context, storage driver.Driver, path string, args model.ArchiveMetaArgs) (*model.ArchiveMetaProvider, error)
func GetArchiveToolAndStream ¶ added in v3.44.0
func GetBalancedStorage ¶
GetBalancedStorage get storage by path
func GetDriverInfoMap ¶
func GetDriverNames ¶
func GetDriverNames() []string
func GetLabelByFileName ¶ added in v3.46.0
func GetPublicSettingItems ¶ added in v3.7.1
func GetPublicSettingItems() ([]model.SettingItem, error)
func GetPublicSettingsMap ¶ added in v3.7.1
func GetSSHPublicKeyByIdAndUserId ¶ added in v3.42.0
func GetSSHPublicKeyByIdAndUserId(id uint, userId uint) (*model.SSHPublicKey, error)
func GetSSHPublicKeyByUserId ¶ added in v3.42.0
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 GetStorageAndActualPath ¶
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 GetStorageVirtualFilesByPath ¶
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 HandleObjsUpdateHook ¶ added in v3.7.1
func HandleSettingItemHook ¶ added in v3.7.1
func HandleSettingItemHook(item *model.SettingItem) (hasHook bool, err error)
func HasStorage ¶ added in v3.7.1
func InternalExtract ¶ added in v3.42.0
func Link ¶
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) ([]model.Obj, error)
List files in storage, not contains virtual file
func ListArchive ¶ added in v3.42.0
func LoadStorage ¶
LoadStorage load exist storage in db to memory
func MustSaveDriverStorage ¶
MustSaveDriverStorage call from specific driver
func RegisterDriver ¶
func RegisterDriver(driver DriverConstructor)
func RegisterObjsUpdateHook ¶ added in v3.6.0
func RegisterObjsUpdateHook(hook ObjsUpdateHook)
func RegisterSettingChangingCallback ¶ added in v3.43.0
func RegisterSettingChangingCallback(f func())
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 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 SettingCacheUpdate ¶ added in v3.42.0
func SettingCacheUpdate()
func StringSliceToUintSlice ¶ added in v3.46.0
func UpdateMeta ¶ added in v3.7.1
func UpdateRole ¶ added in v3.46.0
func UpdateSSHPublicKey ¶ added in v3.42.0
func UpdateSSHPublicKey(k *model.SSHPublicKey) error
func UpdateStorage ¶
UpdateStorage update storage get old storage first drop the storage then reinitialize
func UpdateUser ¶ added in v3.7.1
Types ¶
type CreateLabelFileBinDingReq ¶ added in v3.46.0
type CreateLabelFileBinDingReq struct {
Id string `json:"id"`
Path string `json:"path"`
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"is_dir"`
Modified time.Time `json:"modified"`
Created time.Time `json:"created"`
Sign string `json:"sign"`
Thumb string `json:"thumb"`
Type int `json:"type"`
HashInfoStr string `json:"hashinfo"`
LabelIds string `json:"label_ids"`
}
type DriverConstructor ¶ added in v3.25.0
func GetDriver ¶ added in v3.25.0
func GetDriver(name string) (DriverConstructor, error)
type ObjLabelResp ¶ added in v3.46.0
type ObjLabelResp struct {
Id string `json:"id"`
Path string `json:"path"`
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"is_dir"`
Modified time.Time `json:"modified"`
Created time.Time `json:"created"`
Sign string `json:"sign"`
Thumb string `json:"thumb"`
Type int `json:"type"`
HashInfoStr string `json:"hashinfo"`
LabelList []model.Label `json:"label_list"`
}
func GetFileByLabel ¶ added in v3.46.0
func GetFileByLabel(userId uint, labelId string) (result []ObjLabelResp, err error)
type ObjsUpdateHook ¶ added in v3.6.0
Obj
type SettingItemHook ¶ added in v3.7.1
type SettingItemHook func(item *model.SettingItem) error
Setting