handler

package
v0.0.0-...-6dd7e16 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MPKeyPrefix      = conf.RdsCacheKeyPrefix + "MP_"
	ChunkCount       = "chunk_count"
	FileHash         = "file_hash"
	FileSize         = "file_size"
	ChunkIndexPrefix = "chunk_index_"
)
View Source
const (
	CephKeyPrefix = "/ceph/"
	CephBucket    = "userfile"

	// 注意:OSS上传文件不能以 / 开头 如 不能用 /oss/
	OSSKeyPrefix = "oss/"
)

Variables

This section is empty.

Functions

func CompleteUploadHandler

func CompleteUploadHandler(w http.ResponseWriter, r *http.Request)

上传文件各个分块合并

func DownloadHandler

func DownloadHandler(w http.ResponseWriter, r *http.Request)

func DownloadURLHandler

func DownloadURLHandler(w http.ResponseWriter, r *http.Request)

文件下载接口,返回文件下载url而不是返回文件本身 对于上传到OSS的文件减少本地服务压力,减少1次网络传输

func FileDeleteHandler

func FileDeleteHandler(w http.ResponseWriter, r *http.Request)

TODO : NOTICE 物理删除可能失败,认为删除了meta信息就是删除了文件 删除文件元信息

func FileMetaUpdateHandler

func FileMetaUpdateHandler(w http.ResponseWriter, r *http.Request)

更新文件元信息接口(这里只实现重命名文件名)

func FileQueryHandler

func FileQueryHandler(w http.ResponseWriter, r *http.Request)

批量查询用户上传文件元信息

func GetFileMetaHandler

func GetFileMetaHandler(w http.ResponseWriter, r *http.Request)

获取文件元信息

func Gin_DoSignInHandler

func Gin_DoSignInHandler(ctx *gin.Context)

Gin 处理登录 POST 请求

func Gin_DoSignUpHandler

func Gin_DoSignUpHandler(ctx *gin.Context)

Gin 处理注册 POST 请求

func Gin_HTTPInterceptor

func Gin_HTTPInterceptor() gin.HandlerFunc

Gin 中间件

func Gin_SignInHandler

func Gin_SignInHandler(ctx *gin.Context)

Gin 处理登录 GET 请求 响应登录页面

func Gin_SignUpHandler

func Gin_SignUpHandler(ctx *gin.Context)

Gin分开处理http的get和post 处理注册GET请求响应注册页面

func Gin_UserInfoHandler

func Gin_UserInfoHandler(ctx *gin.Context)

func HTTPInterceptor

func HTTPInterceptor(h http.HandlerFunc) http.HandlerFunc

net/http 中间件 TODO : NOTICE 拦截器,类似python修饰器/java注解,原理类似,在目标函数执行入口前

先执行一段逻辑代码,通过后再执行目标函数

func InitialMultipartUploadHandler

func InitialMultipartUploadHandler(w http.ResponseWriter, r *http.Request)

初始化分块上传

func SignInHandler

func SignInHandler(w http.ResponseWriter, r *http.Request)

登录接口

func SignUpHandler

func SignUpHandler(w http.ResponseWriter, r *http.Request)

处理用户注册请求

func TryFastUploadHandler

func TryFastUploadHandler(w http.ResponseWriter, r *http.Request)

尝试秒传接口

func UploadHandler

func UploadHandler(w http.ResponseWriter, r *http.Request)

处理文件上传 param w 向用户返回数据的RW对象 param r 接收用户请求Request对象指针

func UploadPartHandler

func UploadPartHandler(w http.ResponseWriter, r *http.Request)

上传文件分块

func UploadSucHandler

func UploadSucHandler(w http.ResponseWriter, r *http.Request)

上传已完成

func UserInfoHandler

func UserInfoHandler(w http.ResponseWriter, r *http.Request)

UserInfoHandler : 查询用户信息

Types

type MultipartUploadInfo

type MultipartUploadInfo struct {
	FileHash   string
	FileSize   int
	UploadID   string // 唯一标识某1次上传操作
	ChunkSize  int    // 分块大小,最后1个分块要独立计算
	ChunkCount int    // 分块数量
}

大文件分块上传元信息

Jump to

Keyboard shortcuts

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