api

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownError         = "UNKNOWN_ERROR"
	InvalidRequest       = "INVALID_REQUEST"
	FileNotFound         = "FILE_NOT_FOUND"
	FileDeleted          = "FILE_DELETED"
	IllegalFormat        = "ILLEGAL_FORMAT"
	InvalidAuthorization = "INVALID_AUTHORIZATION"
)

Variables

View Source
var (
	ErrFileNotFound  = errors.New("file not found")
	ErrFileDeleted   = errors.New("file deleted")
	ErrIllegalFormat = errors.New("illegal format")

	ErrMapper = map[string]error{
		FileNotFound:  ErrFileNotFound,
		FileDeleted:   ErrFileDeleted,
		IllegalFormat: ErrIllegalFormat,
	}
)

Functions

func DeleteFile added in v0.1.7

func DeleteFile(rail miso.Rail, fileId string) error

func DownloadFile added in v0.1.7

func DownloadFile(rail miso.Rail, tmpToken string, writer io.Writer) error

func DownloadFileDirect added in v0.1.11

func DownloadFileDirect(rail miso.Rail, fileId string, writer io.Writer) error

func GenTempFileKey added in v0.1.7

func GenTempFileKey(rail miso.Rail, fileId string, filename string) (string, error)

func TriggerFileUnzip added in v0.1.7

func TriggerFileUnzip(rail miso.Rail, req UnzipFileReq) error

func UploadFile added in v0.1.7

func UploadFile(rail miso.Rail, filename string, dat io.Reader) (string, error)

Types

type DirectDownloadFileReq added in v0.1.11

type DirectDownloadFileReq struct {
	FileId string
}

type FetchFileInfoReq added in v0.1.7

type FetchFileInfoReq struct {
	FileId       string
	UploadFileId string
}

type FstoreFile

type FstoreFile struct {
	FileId     string      `json:"fileId" desc:"file unique identifier"`
	Name       string      `json:"name" desc:"file name"`
	Status     string      `json:"status" desc:"status, 'NORMAL', 'LOG_DEL' (logically deleted), 'PHY_DEL' (physically deleted)"`
	Size       int64       `json:"size" desc:"file size in bytes"`
	Md5        string      `json:"md5" desc:"MD5 checksum"`
	UplTime    miso.ETime  `json:"uplTime" desc:"upload time"`
	LogDelTime *miso.ETime `json:"logDelTime" desc:"logically deleted at"`
	PhyDelTime *miso.ETime `json:"phyDelTime" desc:"physically deleted at"`
}

func FetchFileInfo added in v0.1.7

func FetchFileInfo(rail miso.Rail, req FetchFileInfoReq) (FstoreFile, error)

type UnzipFileReplyEvent added in v0.1.7

type UnzipFileReplyEvent struct {
	ZipFileId  string
	ZipEntries []ZipEntry
	Extra      string
}

type UnzipFileReq added in v0.1.7

type UnzipFileReq struct {
	// zip file's mini-fstore file_id.
	FileId string `valid:"notEmpty" desc:"file_id of zip file"`

	// rabbitmq exchange (both the exchange and queue must all use the same name, and are bound together using routing key '#').
	ReplyToEventBus string `valid:"notEmpty" desc:"name of the rabbitmq exchange to reply to, routing_key is '#'"`

	// Extra information that will be passed back to the caller in reply event.
	Extra string `desc:"extra information that will be passed around for the caller"`
}

type ZipEntry added in v0.1.7

type ZipEntry struct {
	FileId string
	Md5    string
	Name   string
	Size   int64
}

Jump to

Keyboard shortcuts

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