pkg

package
v0.0.0-...-7b3ddb2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERRCODE_INTERNAL_ERROR = 550 + iota
	ERRCODE_NAME_OR_PASSWORD
	ERRCODE_SYSBUSY
	ERRCODE_PARAM_ERROR
	ERRCODE_INVALID_CFG
	ERRCODE_ZONE_NOT_EXISTS
	ERRCODE_LOCAL_ZONE_OPS_FAILED
	ERRCODE_DUP_ZONE
	ERRCODE_DUP_DB
	ERRCODE_INVALID_ENGINE
	ERRCODE_DB_NOTEXISTS
	ERRCODE_DB_Not_Empty
	ERRCODE_DUP_SPACE
	ERRCODE_SPACE_NOTEXISTS
	ERRCODE_PARTITION_HAS_TASK_NOW
	ERRCODE_REPLICA_NOT_EXISTS
	ERRCODE_DUP_REPLICA
	ERRCODE_PARTITION_REPLICA_LEADER_NOT_DELETE
	ERRCODE_PS_NOTEXISTS
	ERRCODE_PS_Already_Exists
	ERRCODE_LOCAL_SPACE_OPS_FAILED
	ERRCODE_Local_PS_Ops_Failed
	ERRCODE_GENID_FAILED
	ERRCODE_LOCALDB_OPTFAILED
	ERRCODE_SPACE_SCHEMA_INVALID
	ERRCODE_RPC_GET_CLIENT_FAILED
	ERRCODE_RPC_INVALID_RESP
	ERRCODE_RPC_INVOKE_FAILED
	ERRCODE_RPC_PARAM_ERROR
	ERRCODE_METHOD_NOT_IMPLEMENT
	ERRCODE_USER_NOT_EXISTS
	ERRCODE_DUP_USER
	ERRCODE_USER_OPS_FAILED
	ERRCODE_AUTHENTICATION_FAILED
	ERRCODE_REGION_NOT_EXISTS
	ERRCODE_MASTER_PS_CAN_NOT_SELECT
	ERRCODE_MASTER_PS_NOT_ENOUGH_SELECT
	ERRCODE_PARTITION_DUPLICATE
	ERRCODE_PARTITION_NOT_EXIST
	ERRCODE_PARTITION_NOT_LEADER
	ERRCODE_PARTITION_NO_LEADER
	ERRCODE_PARTITION_REQ_PARAM
	ERRCODE_PARTITION_FROZEN
	ERRCODE_UNKNOWN_PARTITION_RAFT_CMD_TYPE
	ERRCODE_MASTER_SERVER_IS_NOT_RUNNING
	ERRCODE_PARTITION_IS_INVALID
	ERRCODE_PARTITION_IS_CLOSED
	ERRCODE_DOCUMENT_NOT_EXIST
	ERRCODE_DOCUMENT_EXIST
	ERRCODE_DOCUMENT_MUST_HAS_SOURCE
	ERRCODE_PULL_OUT_VERSION_NOT_MATCH
	ERRCODE_FUNC_CAN_NOT_INVOKE_IN_FROZEN_ENGINE
)
View Source
const ERRCODE_SUCCESS = 200

http response error code and error message definitions

Variables

View Source
var (
	ErrGeneralSuccess            = errors.New("success")
	ErrGeneralMethodNotImplement = errors.New("method not implement")
	ErrGeneralServiceUnavailable = errors.New("Service Unavailable")
	ErrGeneralInternalError      = errors.New("internal error")
	ErrGeneralTimeoutError       = errors.New("timeout error")
	ErrGeneralSysBusy            = errors.New("system busy")
	ErrGeneralParamError         = errors.New("param error")
	ErrGeneralInvalidCfg         = errors.New("config error")
	ErrGeneralNameOrPassword     = errors.New("username or password err")
)

General server err

View Source
var (
	ErrPartitionDuplicate             = errors.New("Partition Already Exists")
	ErrPartitionNotExist              = errors.New("Partition Not Exists")
	ErrPartitionClosed                = errors.New("Partition is Closed")
	ErrPartitionInvalid               = errors.New("Partition is Invalid")
	ErrPartitionNotLeader             = errors.New("Partition Not Leader")
	ErrPartitionReqParam              = errors.New("Request Param Error")
	ErrPartitionFrozen                = errors.New("Partition Frozen Error")
	ErrUnknownPartitionRaftCmdType    = errors.New("Unknown partition raft cmd type")
	ErrPartitionEngineNameInvalid     = errors.New("Registration engine name is invalid")
	ErrPartitionFieldNotFound         = errors.New("field not found")
	ErrRecordJournal                  = errors.New("Record journal failed")
	ErrFuncCanNotInvokeInFrozenEngine = errors.New("Func can not invoke in frozen engine")
)

Partition err

View Source
var (
	ErrDocumentNotExist                 = errors.New("Document Not Exists")
	ErrDocDelVersionNotSpecified        = errors.New("document delete version not specified")
	ErrDocReplaceVersionNotSpecified    = errors.New("document replace version not specified")
	ErrDocumentMergeVersionNotSpecified = errors.New("document merge version not specified")
	ErrDocPulloutVersionNotMatch        = errors.New("document pullout version not match")
	ErrDocumentExist                    = errors.New("Document Exists")
	ErrDocumentMustHasSource            = errors.New("Document Must has source")
)
View Source
var (
	ErrMasterAuthenticationFailed            = errors.New("master authentication failed")
	ErrMasterRegionNotExists                 = errors.New("region not exists")
	ErrMasterZoneNotExists                   = errors.New("zone not exists")
	ErrMasterUserNotExists                   = errors.New("user not exists")
	ErrMasterLocalZoneOpsFailed              = errors.New("local storage zone operation error")
	ErrMasterLocalUserOpsFailed              = errors.New("local storage user operation error")
	ErrMasterDupZone                         = errors.New("duplicated zone")
	ErrMasterDupUser                         = errors.New("duplicated user")
	ErrMasterDupDb                           = errors.New("duplicated database")
	ErrMasterInvalidEngine                   = errors.New("invalid engine")
	ErrMasterDbNotExists                     = errors.New("db not exists")
	ErrMasterDbNotEmpty                      = errors.New("db not empty")
	ErrMasterDupSpace                        = errors.New("duplicated space")
	ErrMasterSpaceNotExists                  = errors.New("space not exists")
	ErrMasterUseerNotExists                  = errors.New("user not exists")
	ErrMasterPartitionHasTaskNow             = errors.New("partition has task now")
	ErrMasterReplicaNotExists                = errors.New("replica not exists")
	ErrMasterDupReplica                      = errors.New("duplicated Replica")
	ErrMasterPartitionReplicaLeaderNotDelete = errors.New("partition replica leader can not delete")

	ErrMasterPSNotExists         = errors.New("partition server is not exists")
	ErrMasterPSCanNotSelect      = errors.New("can not select PS")
	ErrMasterPSNotEnoughSelect   = errors.New("not enough PS")
	ErrMasterPSAlreadyExists     = errors.New("partition server is already exists")
	ErrMasterLocalSpaceOpsFailed = errors.New("local storage space operation error")
	ErrMasterLocalPSOpsFailed    = errors.New("local storage ps operation error")
	ErrMasterGenIdFailed         = errors.New("generate id is failed")
	ErrMasterLocalDbOpsFailed    = errors.New("local storage db operation error")
	ErrMasterSpaceSchemaInvalid  = errors.New("space schema invalid")

	ErrMasterRpcGetClientFailed = errors.New("get rpc client handle is failed")
	ErrMasterRpcInvalidResp     = errors.New("invalid rpc response")
	ErrMasterRpcInvokeFailed    = errors.New("invoke rpc is failed")
	ErrMasterRpcParamErr        = errors.New("rpc param error")
	ErrMasterServerIsNotRunning = errors.New("master server is not running")
)

Functions

func CodeErr

func CodeErr(code int64) error

func ErrCode

func ErrCode(err error) int64

get err code by error if error is nil , return ERRCODE_SUCCESS

func ErrError

func ErrError(err error) string

Types

type Err

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

func NewErr

func NewErr(code int, msg string) *Err

func NewErrCode

func NewErrCode(code int) *Err

func NewErrMsg

func NewErrMsg(msg string) *Err

func NewErrMsgError

func NewErrMsgError(err error) *Err

func (*Err) GetCode

func (e *Err) GetCode() int

func (*Err) GetError

func (e *Err) GetError() error

func (*Err) GetMsg

func (e *Err) GetMsg() string

func (*Err) SetCode

func (e *Err) SetCode(code int) *Err

func (*Err) SetMsg

func (e *Err) SetMsg(msg string) *Err

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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