siyouyunsdk

package module
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 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 (
	EventStatusAppend = iota + 1
	EventStatusRunning
	EventStatusError
	EventStatusFinish
)

处理任务的状态

View Source
const (
	AppCodeEnvKey = "AppCode"
)

Variables

View Source
var App *app

Functions

func NewApp

func NewApp() *app

Types

type AppFS added in v0.1.22

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

func (*AppFS) EnsureDirExist added in v0.1.22

func (afs *AppFS) EnsureDirExist(ps ...string)

EnsureDirExist 确保目录存在

func (*AppFS) FileExists added in v0.1.22

func (afs *AppFS) FileExists(path string) bool

FileExists 文件是否存在

func (*AppFS) InodeToFileInfo added in v0.1.22

func (afs *AppFS) InodeToFileInfo(inode int64) *gateway.FileInfoRes

InodeToFileInfo inode转fileInfo

func (*AppFS) InodeToPath added in v0.1.22

func (afs *AppFS) InodeToPath(inode int64) string

InodeToPath inode转path

func (*AppFS) InodesToFileInfos added in v0.1.22

func (afs *AppFS) InodesToFileInfos(inodes ...int64) map[string]gateway.FileInfoRes

InodesToFileInfos inodes转fileInfos

func (*AppFS) MkdirAll added in v0.1.22

func (afs *AppFS) MkdirAll(path string) error

MkdirAll 递归创建目录

func (*AppFS) Open added in v0.1.22

func (afs *AppFS) Open(path string) (*os.File, error)

Open 打开文件

func (*AppFS) OpenFile added in v0.1.22

func (afs *AppFS) OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

OpenFile 打开或创建文件

func (*AppFS) PathToInode added in v0.1.22

func (afs *AppFS) PathToInode(path string) int64

PathToInode path转inode

func (*AppFS) Remove added in v0.1.22

func (afs *AppFS) Remove(path string) error

Remove 删除文件

func (*AppFS) Rename added in v0.1.22

func (afs *AppFS) Rename(oldPath, newPath string) error

Rename 重命名文件

type EventFS added in v0.1.21

type EventFS struct {
	EventFileInode int64
	FS             *FS
	AppFS          *AppFS
}

func (*EventFS) OpenEventFile added in v0.1.21

func (efs *EventFS) OpenEventFile() (*os.File, error)

OpenEventFile 打开事件相关文件

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 {
	AppCodeName string

	*utils.UserNamespace
	// contains filtered or unexported fields
}

FS fs

func (*FS) EnsureDirExist added in v0.1.16

func (fs *FS) EnsureDirExist(ps ...string)

EnsureDirExist 确保目录存在

func (*FS) Exec added in v0.1.19

func (fs *FS) Exec(f func(*gorm.DB) error) error

Exec fs执行sql

func (*FS) FileExists added in v0.1.16

func (fs *FS) FileExists(path string) bool

FileExists 文件是否存在

func (*FS) InodeToFileInfo added in v0.1.16

func (fs *FS) InodeToFileInfo(inode int64) *gateway.FileInfoRes

InodeToFileInfo inode转fileInfo

func (*FS) InodeToPath added in v0.1.16

func (fs *FS) InodeToPath(inode int64) string

InodeToPath inode转path

func (*FS) InodesToFileInfos added in v0.1.16

func (fs *FS) InodesToFileInfos(inodes ...int64) map[string]gateway.FileInfoRes

InodesToFileInfos inodes转fileInfos

func (*FS) MkdirAll added in v0.1.21

func (fs *FS) MkdirAll(path string) error

MkdirAll 递归创建目录

func (*FS) Open added in v0.1.7

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

Open 打开文件

func (*FS) OpenFile added in v0.1.21

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

OpenFile 打开或创建文件

func (*FS) PathToInode added in v0.1.16

func (fs *FS) PathToInode(path string) int64

PathToInode path转inode

func (*FS) Remove added in v0.1.21

func (fs *FS) Remove(path string) error

Remove 删除文件

func (*FS) Rename added in v0.1.21

func (fs *FS) Rename(oldPath, newPath string) error

Rename 重命名文件

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 *EventFS) 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))

type TableDefine added in v0.1.21

type TableDefine struct {
	Name    string
	Defines []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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