siyouyunsdk

package module
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

README

siyouyun_sdk

Siyouyun FaaS Service SDK

Documentation

Index

Constants

View Source
const (
	AppCodeEnvKey = "APPCODE"
	IconPath      = "/home/app/icon.png"
)
View Source
const (
	FileEventAdd    = iota + 1 // 文件创建
	FileEventDelete            // 文件删除
	FileEventRename            // 文件重命名
)

文件事件类型

Variables

This section is empty.

Functions

func Alive added in v0.3.2

func Alive(ctx iris.Context)

Alive 激活函数接口

func GetIcon added in v0.4.4

func GetIcon(ctx iris.Context)

GetIcon 获取图标

Types

type Ability added in v0.2.3

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

Ability app ability set

func (*Ability) AI added in v0.5.3

func (a *Ability) AI() (*ability.AI, error)

func (*Ability) Destroy added in v0.5.4

func (a *Ability) Destroy()

func (*Ability) FFmpeg added in v0.2.3

func (a *Ability) FFmpeg() (*ability.FFmpeg, error)

func (*Ability) FS added in v0.5.4

func (a *Ability) FS() *ability.FS

func (*Ability) KV added in v0.2.3

func (a *Ability) KV() (*ability.KV, error)

func (*Ability) Message added in v0.2.47

func (a *Ability) Message() (*ability.Message, error)

func (*Ability) Schedule added in v0.2.29

func (a *Ability) Schedule() (*ability.Schedule, error)

type AbilityInterface added in v0.5.4

type AbilityInterface interface {
	// Name of ability
	Name() string
	// Close resources
	Close()
}

AbilityInterface ability interface

type AppBuilder added in v0.4.16

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

AppBuilder app builder

func NewAppBuilder added in v0.4.16

func NewAppBuilder(appCode string) *AppBuilder

NewAppBuilder new a custom app builder

func (*AppBuilder) Build added in v0.4.16

func (b *AppBuilder) Build()

func (*AppBuilder) WithApi added in v0.4.16

func (b *AppBuilder) WithApi(api SiyouFaaSApi) *AppBuilder

func (*AppBuilder) WithDB added in v0.4.16

func (b *AppBuilder) WithDB(db *gorm.DB) *AppBuilder

func (*AppBuilder) WithNC added in v0.4.18

func (b *AppBuilder) WithNC(nc *nats.Conn) *AppBuilder

type AppStruct added in v0.1.23

type AppStruct struct {
	AppCode string
	Event   *EventHolder
	Ability *Ability     // app ability
	Api     SiyouFaaSApi // app interfaces
	// contains filtered or unexported fields
}
var App *AppStruct

func NewApp

func NewApp() *AppStruct

NewApp new standard app

func (*AppStruct) Destroy added in v0.5.4

func (a *AppStruct) Destroy()

func (*AppStruct) WithAI added in v0.5.4

func (a *AppStruct) WithAI()

WithAI add AI support

func (*AppStruct) WithDataMigrator added in v0.9.5

func (a *AppStruct) WithDataMigrator(migrateData func(db *gorm.DB) error, afterFunc func(*utils.UserGroupNamespace) error)

WithDataMigrator Migrate db data The data is migrated when the user is registered After the migrateData processing of each UGN is completed, afterFunc is executed (After the transaction is committed)

func (*AppStruct) WithEventHolder added in v0.1.23

func (a *AppStruct) WithEventHolder()

WithEventHolder 初始化事件监听器

func (*AppStruct) WithFFmpeg added in v0.5.4

func (a *AppStruct) WithFFmpeg()

WithFFmpeg add ffmpeg support

func (*AppStruct) WithFS added in v0.5.4

func (a *AppStruct) WithFS()

WithFS add fs support

func (*AppStruct) WithKV added in v0.5.4

func (a *AppStruct) WithKV()

WithKV add kv support

func (*AppStruct) WithMessage added in v0.5.4

func (a *AppStruct) WithMessage()

WithMessage add message support

func (*AppStruct) WithSchedule added in v0.7.0

func (a *AppStruct) WithSchedule()

WithSchedule add schedule support

func (*AppStruct) WithSchemaMigrator added in v0.9.5

func (a *AppStruct) WithSchemaMigrator(migrateSchema func(db *gorm.DB) error, afterFunc func(*utils.UserGroupNamespace) error)

WithSchemaMigrator Migrate db schema The schema is migrated when the application is started After the migrateSchema processing of each UGN is completed, afterFunc is executed (After the transaction is committed)

type ConsumeStatus added in v0.2.7

type ConsumeStatus int
const (
	ConsumeSuccess ConsumeStatus = iota + 1
	ConsumeRetry
	ConsumeFail
)

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 FileEvent added in v0.1.7

type FileEvent struct {
	UGN        *utils.UserGroupNamespace `json:"ugn"`
	SrcUFI     string                    `json:"srcUfi"` // rename ufi
	UFI        string                    `json:"ufi"`
	Inode      uint64                    `json:"inode"`
	Action     int                       `json:"action"`
	WithAvatar bool                      `json:"withAvatar"`
}

type MediaType added in v0.4.5

type MediaType string

MediaType 文件媒体类型

const (
	MediaTypeText    MediaType = "text"
	MediaTypeImage   MediaType = "image"
	MediaTypeAudio   MediaType = "audio"
	MediaTypeVideo   MediaType = "video"
	MediaTypeMessage MediaType = "message"
)

偏好设置可以关注的文件媒体类型,上半部分为标准媒体类型,下半部分为自定义媒体类型 标准媒体类型

const (
	MediaTypeAll        MediaType = "all"         // 全部类型
	MediaTypeCompress   MediaType = "compress"    // 压缩包类型
	MediaTypeImageVideo MediaType = "image-video" // 图片+视频类型
	MediaTypeDoc        MediaType = "doc"         // 文档类型
	MediaTypeBt         MediaType = "bt"          // 种子类型
	MediaTypeEbook      MediaType = "ebook"       // 电子书类型
	MediaTypeSoftware   MediaType = "software"    // 软件包类型
	MediaTypeOther      MediaType = "other"       // 其他类型
)

自定义媒体类型

type PreferOptions added in v0.1.7

type PreferOptions struct {
	MediaType     MediaType                                   `json:"mediaType"`     // 媒体类型
	FileEventType int                                         `json:"fileEventType"` // 事件类型
	FollowDirs    []string                                    `json:"followDirs"`    // 关注目录(不设置默认所有)
	ExcludeExts   []string                                    `json:"excludeExts"`   // 排除的文件后缀
	Description   string                                      `json:"description"`   // 描述
	Priority      TaskLevel                                   `json:"priority"`      // 优先级(资源占用等级)
	Handler       func(fe *FileEvent) (ConsumeStatus, string) `json:"-"`             // 处理器
}

PreferOptions 事件偏好选项

type SiyouFaaSApi added in v0.4.15

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

func (SiyouFaaSApi) Delete added in v0.4.15

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

func (SiyouFaaSApi) Get added in v0.4.15

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

func (SiyouFaaSApi) Post added in v0.4.15

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

func (SiyouFaaSApi) Put added in v0.4.15

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

type TaskLevel added in v0.2.14

type TaskLevel int
const (
	HighLevel TaskLevel = iota + 1
	MidLevel
	LowLevel
)

Directories

Path Synopsis
internal
rdb
pkg
dto

Jump to

Keyboard shortcuts

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