Documentation ¶
Index ¶
- Constants
- Variables
- func AddSecret(instanceId string, secret ...string)
- func AddWebMimeType(ext string, mimetype string)
- func GetMimeType(ext string) string
- func GetSecret(secret string) (instance string)
- func SetConfigMap(config *ConfigMap)
- type AgentConfig
- type BingLog
- type BingLogDTO
- type BinlogQueryDTO
- type BinlogQueryResultDTO
- type BootMode
- type ClientConfig
- type Command
- type ConfigMap
- func (c *ConfigMap) BatchUpdate(w func(tx *bolt.Tx) error) error
- func (c *ConfigMap) GetConfig(key string) (ret []byte, err error)
- func (c *ConfigMap) GetFile(key string) (ret []byte, err error)
- func (c *ConfigMap) IteratorFailedBinlog(iterator func(c *bolt.Cursor) error) error
- func (c *ConfigMap) PutConfig(key string, value []byte) error
- func (c *ConfigMap) PutFailedBinlogPos(binlogPos *BinlogQueryDTO) error
- func (c *ConfigMap) PutFile(binlogs []BingLogDTO) error
- type FileId
- type FileInfo
- type Header
- type Instance
- type InstanceMap
- type Operation
- type OperationResult
- type RegisterState
- type Role
- type Server
- type StorageConfig
- type StorageServer
- type TrackerConfig
- type UploadResult
Constants ¶
View Source
const ( VERSION = "2.0.0-dev" // BOOT_CLIENT BootMode = 0 BOOT_STORAGE BootMode = 1 BOOT_TRACKER BootMode = 2 BOOT_AGENT BootMode = 3 // GROUP_PATTERN = "^[0-9a-zA-Z-_]{1,30}$" SECRET_PATTERN = "^[^@]{1,30}$" SERVER_PATTERN = "^(([^@^,]{1,30})@)?([^@]+):([1-9][0-9]{0,5})$" HTTP_AUTH_PATTERN = "^([^:]+):([^:]+)$" INSTANCE_ID_PATTERN = "^[0-9a-z-]{8}$" FILE_META_PATTERN = "^([0-9a-zA-Z-_]{1,30})/([0-9A-F]{2})/([0-9A-F]{2})/([0-9a-f]{32})$" // DEFAULT_STORAGE_TCP_PORT = 10706 DEFAULT_STORAGE_HTTP_PORT = 11222 DEFAULT_TRACKER_TCP_PORT = 11706 DEFAULT_TRACKER_HTTP_PORT = 12222 DEFAULT_AGENT_TCP_PORT = 12706 DEFAULT_AGENT_HTTP_PORT = 13222 BUFFER_SIZE = 1 << 15 // 32k DEFAULT_GROUP = "G01" // OPERATION_RESPONSE Operation = 0 OPERATION_CONNECT Operation = 1 OPERATION_UPLOAD Operation = 2 OPERATION_DOWNLOAD Operation = 3 OPERATION_QUERY Operation = 4 OPERATION_SYNC_INSTANCES Operation = 5 OPERATION_PUSH_BINLOGS Operation = 6 OPERATION_SYNC_BINLOGS Operation = 7 // SUCCESS OperationResult = 0 ERROR OperationResult = 1 UNAUTHORIZED OperationResult = 2 NOT_FOUND OperationResult = 3 UNKNOWN_OPERATION OperationResult = 4 // CMD_SHOW_HELP Command = 0 CMD_SHOW_VERSION Command = 1 CMD_UPDATE_CONFIG Command = 2 CMD_SHOW_CONFIG Command = 3 CMD_UPLOAD_FILE Command = 4 CMD_DOWNLOAD_FILE Command = 5 CMD_INSPECT_FILE Command = 6 CMD_BOOT_TRACKER Command = 7 CMD_BOOT_STORAGE Command = 8 CMD_TEST_UPLOAD Command = 9 CMD_GENERATE_TOKEN Command = 10 CMD_BOOT_AGENT Command = 11 // ROLE_TRACKER Role = 1 ROLE_STORAGE Role = 2 ROLE_PROXY Role = 3 ROLE_CLIENT Role = 4 ROLE_ANY Role = 5 // REGISTER_HOLD RegisterState = 1 REGISTER_FREE RegisterState = 2 // REGISTER_INTERVAL = time.Second * 30 SYNCHRONIZE_INTERVAL = time.Second * 45 FILE_ID_SIZE = 86 BUCKET_KEY_CONFIGMAP = "configMap" BUCKET_KEY_FAILED_BINLOG_POS = "failedBinlogPos" BUCKET_KEY_FILEID = "fileIds" )
Variables ¶
View Source
var ( NotFoundErr = errors.New("file not found") ServerErr = errors.New("server internal error") InitializedTrackerConfiguration *TrackerConfig InitializedStorageConfiguration *StorageConfig InitializedAgentConfiguration *AgentConfig InitializedClientConfiguration *ClientConfig FileMetaPatternRegexp = regexp.MustCompile(FILE_META_PATTERN) ServerPatternRegexp = regexp.MustCompile(SERVER_PATTERN) BootAs BootMode CusterSecret = make(map[string]string) )
Functions ¶
func AddWebMimeType ¶
func GetMimeType ¶
GetContentTypeHeader gets mime type by file ext
func SetConfigMap ¶
func SetConfigMap(config *ConfigMap)
Types ¶
type AgentConfig ¶
type AgentConfig struct { Trackers []string `json:"trackers"` Secret string `json:"secret"` BindAddress string `json:"bindAddress"` Port int `json:"port"` DataDir string `json:"dataDir"` LogLevel string `json:"logLevel"` LogDir string `json:"logDir"` SaveLog2File bool `json:"saveLog2File"` MaxRollingLogfileSize int `json:"maxRollingLogfileSize"` LogRotationInterval string `json:"logRotationInterval"` HttpPort int `json:"httpPort"` InstanceId string HistorySecrets map[string]string TmpDir string ParsedTrackers []Server }
type BingLogDTO ¶
type BinlogQueryDTO ¶
BinlogQueryDTO is the binlog query entity between storage servers.
type BinlogQueryResultDTO ¶
type BinlogQueryResultDTO struct { BinlogQueryDTO Logs []BingLogDTO `json:"logs"` }
BinlogQueryResultDTO is the binlog query result entity between storage servers.
type ClientConfig ¶
type ClientConfig struct { Trackers []string `json:"trackers"` Storages []string `json:"storages"` LogLevel string `json:"logLevel"` Secret string `json:"secret"` PrivateUpload bool `json:"private_upload"` TestScale int `json:"test_scale"` TestThread int `json:"test_thread"` ParsedTrackers []Server }
type ConfigMap ¶
type ConfigMap struct {
// contains filtered or unexported fields
}
func GetConfigMap ¶
func GetConfigMap() *ConfigMap
func NewConfigMap ¶
func (*ConfigMap) IteratorFailedBinlog ¶
func (*ConfigMap) PutFailedBinlogPos ¶
func (c *ConfigMap) PutFailedBinlogPos(binlogPos *BinlogQueryDTO) error
func (*ConfigMap) PutFile ¶
func (c *ConfigMap) PutFile(binlogs []BingLogDTO) error
type Header ¶
type Header struct { Operation Operation `json:"op"` Result OperationResult `json:"ret"` Msg string `json:"msg"` Attributes map[string]string `json:"ats"` }
type InstanceMap ¶
type OperationResult ¶
type OperationResult byte
type RegisterState ¶
type RegisterState byte
type Server ¶
type Server struct { Host string `json:"host"` Port uint16 `json:"port"` HttpPort uint16 `json:"httpPort"` Secret string `json:"secret"` HistorySecrets map[string]string `json:"history_secret"` // 历史密码 InstanceId string `json:"instanceId"` }
func (*Server) ConnectionString ¶
type StorageConfig ¶
type StorageConfig struct { Trackers []string `json:"trackers"` Secret string `json:"secret"` Group string `json:"group"` BindAddress string `json:"bindAddress"` Port int `json:"port"` AdvertiseAddress string `json:"advertiseAddress"` AdvertisePort int `json:"advertisePort"` DataDir string `json:"dataDir"` PreferredNetworks string `json:"preferredNetworks"` LogLevel string `json:"logLevel"` LogDir string `json:"logDir"` SaveLog2File bool `json:"saveLog2File"` MaxRollingLogfileSize int `json:"maxRollingLogfileSize"` LogRotationInterval string `json:"logRotationInterval"` EnableHttp bool `json:"enableHttp"` HttpPort int `json:"httpPort"` EnableMimeTypes bool `json:"enableMimeTypes"` Readonly bool `json:"readonly"` PublicAccessMode bool `json:"publicAccessMode"` AllowedDomains []string `json:"allowedDomains"` InstanceId string HistorySecrets map[string]string TmpDir string ParsedTrackers []Server }
type StorageServer ¶
func (*StorageServer) ToServer ¶
func (s *StorageServer) ToServer() *Server
type TrackerConfig ¶
type TrackerConfig struct { Trackers []string `json:"trackers"` Secret string `json:"secret"` InstanceId string BindAddress string `json:"bindAddress"` Port int `json:"port"` AdvertiseAddress string `json:"advertiseAddress"` AdvertisePort int `json:"advertisePort"` DataDir string `json:"dataDir"` PreferredNetworks string `json:"preferredNetworks"` LogLevel string `json:"logLevel"` LogDir string `json:"logDir"` SaveLog2File bool `json:"saveLog2File"` MaxRollingLogfileSize int `json:"maxRollingLogfileSize"` LogRotationInterval string `json:"logRotationInterval"` EnableHttp bool `json:"enableHttp"` HttpPort int `json:"httpPort"` // TODO add advertise http port HistorySecrets map[string]string ParsedTrackers []Server }
type UploadResult ¶
Click to show internal directories.
Click to hide internal directories.