siyouyunfaas

package module
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

README

siyouyun_sdk

Siyouyun FaaS Service SDK

Documentation

Index

Constants

View Source
const (
	FileEventAdd = iota + 1
	FileEventDelete
)

文件事件类型,文件创建与文件删除

View Source
const (
	EventStatusError  = 3
	EventStatusFinish = 4
)

处理任务的状态

View Source
const (
	AppCodeEnvKey = "AppCode"
)

Variables

This section is empty.

Functions

func EnsureDirExist added in v0.1.15

func EnsureDirExist(ps ...string)

func InodeToPath added in v0.1.7

func InodeToPath(app *App, un *utils.UserNamespace, inode int64) string

InodeToPath inode转fullpath

func PathToInode added in v0.1.7

func PathToInode(app *App, un *utils.UserNamespace, fullpath string) int64

PathToInode fullpath为用户空间的相对fullpath

Types

type App

type App struct {
	AppCode string
	Api     SiyouFaasApi
	AppInfo *entity.AppRegisterInfo
	Event   *EventHolder
	// contains filtered or unexported fields
}

func NewApp

func NewApp() *App

func (*App) Exec added in v0.1.3

func (a *App) Exec(ctx iris.Context, f func(*gorm.DB) error) error

func (*App) NewFSFromCtx added in v0.1.15

func (a *App) NewFSFromCtx(ctx iris.Context) *FS

func (*App) WithEventHolder added in v0.1.15

func (a *App) WithEventHolder()

WithEventHolder 初始化事件监听器

type Edge added in v0.1.7

type Edge struct {
	Parent         int64
	Name           string
	Inode          int64
	PosixType      int
	MimeGroup      string
	MimeDetail     string
	FullPath       string
	FullParentPath string
}

Edge 文件树

type EventHolder added in v0.1.7

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

func (*EventHolder) Listen added in v0.1.7

func (e *EventHolder) Listen()

Listen 开始监听器工作

func (*EventHolder) SetPrefer added in v0.1.7

func (e *EventHolder) SetPrefer(options ...PreferOptions)

SetPrefer 设置偏好与回调函数

type FS added in v0.1.7

type FS struct {
	*utils.UserNamespace
	EventFileInode int64
	AppCodeName    string
	// contains filtered or unexported fields
}

FS 事件fs

func (*FS) AppMkdir added in v0.1.15

func (efs *FS) AppMkdir(path string) error

AppMkdir 在app存储空间文件创建目录

func (*FS) AppOpen added in v0.1.7

func (efs *FS) AppOpen(path string) (*os.File, error)

AppOpen 打开app存储空间文件

func (*FS) AppOpenFile added in v0.1.7

func (efs *FS) AppOpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

AppOpenFile 打开或创建app存储空间文件

func (*FS) AppRemove added in v0.1.7

func (efs *FS) AppRemove(path string) error

AppRemove 删除app存储空间文件

func (*FS) AppRename added in v0.1.7

func (efs *FS) AppRename(oldPath, newPath string) error

AppRename 重命名app存储空间文件

func (*FS) Open added in v0.1.7

func (efs *FS) Open(path string) (*os.File, error)

Open 只读权限打开用户空间文件

type FileEvent added in v0.1.7

type FileEvent struct {
	Inode     int64  `json:"inode,omitempty"`
	Action    int    `json:"action,omitempty"`
	Username  string `json:"username,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

type FileType added in v0.1.7

type FileType string
const (
	FileTypeAll      FileType = "all"
	FileTypeText     FileType = "text"
	FileTypeImage    FileType = "image"
	FileTypeAudio    FileType = "audio"
	FileTypeVideo    FileType = "video"
	FileTypeMessage  FileType = "message"
	FileTypeCompress FileType = "compress"

	FileTypeImageVideo FileType = "image-video"
	FileTypeDoc        FileType = "doc"
	FileTypeBt         FileType = "bt"
	FileTypeEbook      FileType = "ebook"
	FileTypeSoftware   FileType = "software"
	FileTypeOther      FileType = "other"
)

偏好设置可以关注的文件类型,上半部分为独立类型文件,下半部分为混合类型文件

type PreferOptions added in v0.1.7

type PreferOptions struct {
	FileType      FileType
	FileEventType int
	Description   string
	Handler       func(fs *FS) error
}

type SiyouFaasApi

type SiyouFaasApi map[string]func(iris.Context)

func (SiyouFaasApi) Delete

func (api SiyouFaasApi) Delete(uri string, f func(iris.Context))

func (SiyouFaasApi) Exec

func (api SiyouFaasApi) Exec(uri string, ctx iris.Context)

func (SiyouFaasApi) Get

func (api SiyouFaasApi) Get(uri string, f func(iris.Context))

func (SiyouFaasApi) Post

func (api SiyouFaasApi) Post(uri string, f func(iris.Context))

func (SiyouFaasApi) Put

func (api SiyouFaasApi) Put(uri string, f func(iris.Context))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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