contract

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UnknownDesc the description of Unknown code
	UnknownDesc = "unknown"
	// SuccessDesc the description of Success code
	SuccessDesc = "success"
	// FailDesc the description of Fail code
	FailDesc = "fail"
	// UnauthorizedDesc the description of Unauthorized code
	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"
	// NotModifiedDesc the description of NotModified code
	NotModifiedDesc = "not modified"
	// ChunkNotModifiedDesc the description of ChunkNotModified code
	ChunkNotModifiedDesc = "chunk not modified"
	// ModifiedDesc the description of Modified code
	ModifiedDesc = "modified"
	// ChunkModifiedDesc the description of ChunkModified code
	ChunkModifiedDesc = "chunk modified"
)
View Source
const (
	// FsDir is dir, see FsDirValue
	FsDir = "dir"
	// FsSize file size, bytes
	FsSize = "size"
	// FsHash file hash value
	FsHash = "hash"
	// FsHashValues the hash value of the entire file and first chunk and some checkpoints
	FsHashValues = "hash_values"
	// FsCtime file creation 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"
	// FsNeedCheckpoint return file checkpoint hash or not
	FsNeedCheckpoint = "need_checkpoint"
)
View Source
const (
	// ParamValueTrue the parameter value means true
	ParamValueTrue = "1"
	// ParamValueFalse the parameter value means false
	ParamValueFalse = "0"
	// FsNeedHashValueTrue the optional value of the FsNeedHash parameter, that means let file server return file hash value
	FsNeedHashValueTrue = ParamValueTrue
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk added in v0.3.4

type Chunk struct {
	// Offset the offset relative to the origin of the file
	//
	// The offset less than zero is invalid.
	// The offset equals zero means the first chunk or only one chunk.
	// The offset greater than zero means that have two chunks at least.
	Offset int64 `json:"offset"`

	// Hash calculate the file chunk hash value, if the path is a file
	Hash string `json:"hash"`

	// Size the size of file chunk for bytes
	Size int64 `json:"size"`
}

Chunk the file chunk info that is used to upload the file

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 the unauthorized status code, the current user needs to sign in
	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
	// NotModified  the resource is not modified
	NotModified Code = -7
	// ChunkNotModified the chunk is not modified
	ChunkNotModified Code = -8
	// Modified  the resource is modified
	Modified Code = -9
	// ChunkModified the chunk is modified
	ChunkModified Code = -10
)

func (Code) String added in v0.3.4

func (code Code) String() string

String return the code description name

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"`
	// HashValues the hash value of the entire file and first chunk and some checkpoints
	HashValues hashutil.HashValues `json:"hash_values"`
	// CTime creation 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"`
	// LinkTo link to the real file
	LinkTo string `json:"link_to"`
}

FileInfo the basic file info description

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) Bool

func (v FsDirValue) Bool() bool

Bool current path is a dir or not

func (FsDirValue) Is

func (v FsDirValue) Is(t string) bool

Is is current value equal to dest

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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