Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SuccessDesc the description of Success code SuccessDesc = "success" // FailDesc the description of Fail code FailDesc = "fail" UnauthorizedDesc = "unauthorized" // NotFoundDesc the description of NotFound code NotFoundDesc = "not found" // NoPermissionDesc the description of NoPermission code NoPermissionDesc = "no permission" // ServerErrorDesc the description of ServerError code ServerErrorDesc = "server internal error" // AccessDenyDesc the description of AccessDeny code AccessDenyDesc = "access deny" )
View Source
const ( // FsDir is dir, see FsDirValue FsDir = "dir" // FsSize file size, bytes FsSize = "size" // FsHash file hash value FsHash = "hash" // FsCtime file create time FsCtime = "ctime" // FsAtime file last access time FsAtime = "atime" // FsMtime file last modify time FsMtime = "mtime" // FsPath file path FsPath = "path" // FsNeedHash return file hash or not FsNeedHash = "need_hash" )
View Source
const ( ParamValueTrue = "1" ParamValueFalse = "0" FsNeedHashValueTrue = ParamValueTrue )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code int
Code the status code info
const ( // Unknown the unknown status code Unknown Code = 0 // Success the success status code Success Code = 1 // Fail the standard fail status code Fail Code = -1 Unauthorized Code = -2 // NotFound the resource not found status code NotFound Code = -3 // NoPermission the no permission status code, the user is authorized but has no permission NoPermission Code = -4 // ServerError the server error status code ServerError Code = -5 // AccessDeny deny current access AccessDeny Code = -6 )
type Command ¶
type Command []byte
var ( // InfoCommand send the info command to get server info InfoCommand Command = []byte("info") // AuthCommand send the auth command with username and password to sign in the server AuthCommand Command = []byte("auth") // UnknownCommand unknown command UnknownCommand Command = []byte("unknown") )
type FileInfo ¶
type FileInfo struct {
// Path the file path
Path string `json:"path"`
// IsDir is a dir the path
IsDir FsDirValue `json:"is_dir"`
// Size the size of path for bytes
Size int64 `json:"size"`
// Hash calculate the path hash value, if the path is a file
Hash string `json:"hash"`
// CTime create time, unix sec
CTime int64 `json:"c_time"`
// ATime last access time, unix sec
ATime int64 `json:"a_time"`
// MTime last modify time, unix sec
MTime int64 `json:"m_time"`
}
FileInfo the basic file info description
type FileServerInfo ¶
type FileServerInfo struct {
Status
// ServerAddr the server running address
ServerAddr string `json:"server_addr"`
// SourcePath the source base path of the file server
SourcePath string `json:"source_path"`
// DestPath the dest base path of the file server
DestPath string `json:"dest_path"`
// QueryAddr the query api address of the file server
QueryAddr string `json:"query_addr"`
// PushAddr the push api address of the file server
PushAddr string `json:"push_addr"`
}
FileServerInfo the file server basic info
type FsDirValue ¶
type FsDirValue int
FsDirValue the optional value of FsDir
const ( // FsIsDir current path is a dir FsIsDir FsDirValue = 1 // FsNotDir current path is not a dir FsNotDir FsDirValue = 0 // FsUnknown current path is unknown file type FsUnknown FsDirValue = -1 )
func ParseFsDirValue ¶
func ParseFsDirValue(isDir bool) FsDirValue
ParseFsDirValue parse boolean to FsDirValue
func (FsDirValue) Not ¶
func (v FsDirValue) Not(t string) bool
Not is current value not equal to dest
func (FsDirValue) String ¶
func (v FsDirValue) String() string
String parse the current value to string
type Message ¶ added in v0.3.0
type Message struct {
Data []byte
}
func NewMessage ¶ added in v0.3.0
type Status ¶
type Status struct {
// Code current status code
Code Code `json:"code"`
// Message current status code description
Message string `json:"message"`
// ApiType mark current api type
ApiType ApiType `json:"api_type"`
}
Status the api response status info
func FailStatus ¶
FailStatus create an instance of fail status with specified api type
func NoPermissionStatus ¶ added in v0.3.0
NoPermissionStatus create an instance of no permission status with specified api type
func SuccessStatus ¶
SuccessStatus create an instance of success status with specified api type
func UnauthorizedStatus ¶
UnauthorizedStatus create an instance of unauthorized status with specified api type
Source Files
¶
Click to show internal directories.
Click to hide internal directories.