web

package
v0.0.0-...-dbb8d9c Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: Unlicense Imports: 33 Imported by: 0

Documentation

Overview

Web 实体定义

HTTP Handler 定义及实现

HTTP 初始化

Web 参数初始化

公共方法实现

Index

Constants

View Source
const (
	CONST_SMALL_FILE_SIZE = int(conf.CONST_SMALL_FILE_SIZE)
	// 操作标识
	CONST_FILE_Md5_FILE_NAME   = conf.CONST_FILE_Md5_FILE_NAME
	CONST_Md5_ERROR_FILE_NAME  = conf.CONST_Md5_ERROR_FILE_NAME
	CONST_Md5_QUEUE_FILE_NAME  = conf.CONST_Md5_QUEUE_FILE_NAME
	CONST_REMOME_Md5_FILE_NAME = conf.CONST_REMOME_Md5_FILE_NAME
	//
	CONST_STAT_FILE_COUNT_KEY      = conf.CONST_STAT_FILE_COUNT_KEY
	CONST_STAT_FILE_TOTAL_SIZE_KEY = conf.CONST_STAT_FILE_TOTAL_SIZE_KEY

	CONST_BIG_UPLOAD_PATH_SUFFIX = conf.CONST_BIG_UPLOAD_PATH_SUFFIX

	GO_FASTDFS_IP = conf.GO_FASTDFS_IP
	UPPY_HTML     = conf.UPLOAD_UPPY_HTML
)

Variables

View Source
var (
	DOCKER_DIR     = conf.DirDocker
	DATA_DIR       = conf.DirData
	STORE_DIR      = conf.DirStore
	LARGE_DIR_NAME = conf.DirLargeName
	STATIC_DIR     = conf.DirStatic
	STORE_DIR_NAME = conf.STORE_DIR_NAME
)

项目应用目录

Functions

func GetClusterNotPermitMessage

func GetClusterNotPermitMessage(r *http.Request) string

HTTP响应错误信息, 必须使用正确的节点IP地址访问资源

func IsPeer

func IsPeer(r *http.Request) bool

根据请求IP, 判断访问是否是 集权节点 (发起请求客户端, 必须是集权中的节点)

func SetDownloadHeader

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

下载文件, 设置下载响应 Header

Types

type HttpHandler

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

定义 HTTP Handler

func (*HttpHandler) ServeHTTP

func (hh *HttpHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

定义 Handler ServeHTTP

type HttpServer

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

定义HTTP接口

func NewHttpServer

func NewHttpServer() *HttpServer

初始化HTTP服务

func (*HttpServer) BackUp

func (hs *HttpServer) BackUp(w http.ResponseWriter, r *http.Request)

整理日志和元数据, 根据查询文件信息数据, 处理文件日志信息数据和文件元数据 [date, inner]

func (*HttpServer) CheckFileExist

func (hs *HttpServer) CheckFileExist(w http.ResponseWriter, r *http.Request)

检测(单个)文件是否存在, 存在返回文件信息 [md5 文件标识 , path 文件(绝对)路径]

func (*HttpServer) CheckFilesExist

func (hs *HttpServer) CheckFilesExist(w http.ResponseWriter, r *http.Request)

检测(多个)文件是否存在, 并返回查询到的文件信息 [md5s 文件标识符, 多个文件用逗号分隔]

func (*HttpServer) Download

func (hs *HttpServer) Download(w http.ResponseWriter, r *http.Request)

下载文件

func (*HttpServer) GenGoogleCode

func (hs *HttpServer) GenGoogleCode(w http.ResponseWriter, r *http.Request)

func (*HttpServer) GenGoogleSecret

func (hs *HttpServer) GenGoogleSecret(w http.ResponseWriter, r *http.Request)

func (*HttpServer) GetFileInfo

func (hs *HttpServer) GetFileInfo(w http.ResponseWriter, r *http.Request)

获取文件信息 [md5 文件标识符, path 文件完整下载路径]

func (*HttpServer) GetMd5sForWeb

func (hs *HttpServer) GetMd5sForWeb(w http.ResponseWriter, r *http.Request)

查询日期, files.md5 中所有符合该文件的 文件标识符 [date 日期(2020-217)]

func (*HttpServer) Home

func (hs *HttpServer) Home(w http.ResponseWriter, r *http.Request)

func (*HttpServer) IndexHTML

func (hs *HttpServer) IndexHTML(w http.ResponseWriter, r *http.Request)

上传页面

func (*HttpServer) ListDir

func (hs *HttpServer) ListDir(w http.ResponseWriter, r *http.Request)

列出目录下文件及目录信息 [dir 显示目录, 为空显示根目录]

func (*HttpServer) ReceiveMd5s

func (hs *HttpServer) ReceiveMd5s(w http.ResponseWriter, r *http.Request)

根据文件标识符查询文件, 并添加到 文件上传处理队列 等待处理 [md5s 文件标识符, 多个用逗号隔开]

func (*HttpServer) RemoveEmptyDir

func (hs *HttpServer) RemoveEmptyDir(w http.ResponseWriter, r *http.Request)

移除空目录

func (*HttpServer) RemoveFile

func (hs *HttpServer) RemoveFile(w http.ResponseWriter, r *http.Request)

移除文件 [md5 文件标识符, path 文件完整路径; 优先使用文件标识符]

func (*HttpServer) Repair

func (hs *HttpServer) Repair(w http.ResponseWriter, r *http.Request)

执行修复文件并同步集群数据 [force]

func (*HttpServer) RepairFileInfo

func (hs *HttpServer) RepairFileInfo(w http.ResponseWriter, r *http.Request)

数据迁移

func (*HttpServer) RepairStatWeb

func (hs *HttpServer) RepairStatWeb(w http.ResponseWriter, r *http.Request)

执行该日期统一文件状态数据, 检测状态文件(stat.json)数据, 并修复 [date, inner]

func (*HttpServer) ReportHTML

func (hs *HttpServer) ReportHTML(w http.ResponseWriter, r *http.Request)

报表页面

func (*HttpServer) Search

func (hs *HttpServer) Search(w http.ResponseWriter, r *http.Request)

根据关键字, 搜索含有该关键字名称的文件 [kw 搜索关键词(匹配文件名中包含该关键词的文件, 为空返回所有文件信息)]

func (*HttpServer) Start

func (hs *HttpServer) Start(s en.Server)

func (*HttpServer) Stat

func (hs *HttpServer) Stat(w http.ResponseWriter, r *http.Request)

获取服务状态信息 [echart 操作标识 1 输出图表统计信息, inner 操作标识 1 返回纯数据]

func (*HttpServer) Status

func (hs *HttpServer) Status(w http.ResponseWriter, r *http.Request)

获取应用状态信息

func (*HttpServer) Sync

func (hs *HttpServer) Sync(w http.ResponseWriter, r *http.Request)

异步下载文件(files.md5 , errors.md5) [date 日志, force 是否暴力处理, inner 操作标识]

func (*HttpServer) SyncFileInfo

func (hs *HttpServer) SyncFileInfo(w http.ResponseWriter, r *http.Request)

根据文件信息, 异步从集群下载文件, 获取文件下载地址 (queue.md5) [fileInfo JSON格式]

func (*HttpServer) Upload

func (hs *HttpServer) Upload(w http.ResponseWriter, r *http.Request)

上传文件 [filename 文件名, path 上传路径 , file 文件内容, output=json]

Jump to

Keyboard shortcuts

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