core

package
v0.0.0-...-25da3cc Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessCode = 0
	ErrorCode   = -9999
)
View Source
const ClusterKeyPrefix = "devfeel/rockman/"
View Source
const DefaultLeaderCheckExecutorInterval = 60
View Source
const DefaultTimeLayout = "2006-01-02 15:04:05"

Variables

View Source
var ErrorRpcClientCreate = errors.New("create rpc client error")

Functions

func GetNodeKeyPrefix

func GetNodeKeyPrefix(clusterId string) string

Types

type ClusterInfo

type ClusterInfo struct {
	ClusterId             string
	RegistryServerUrl     string
	LeaderKey             string
	LeaderServer          string
	NodeNum               int
	WatchLeaderRetryLimit int
	QueryResourceInterval int
}

type CpuResources

type CpuResources []*ResourceInfo

func (CpuResources) Len

func (rs CpuResources) Len() int

func (CpuResources) Less

func (rs CpuResources) Less(i, j int) bool

func (CpuResources) Swap

func (rs CpuResources) Swap(i, j int)

type ExecutorInfo

type ExecutorInfo struct {
	TaskConfig *TaskConfig
	Worker     *NodeInfo
}

func (*ExecutorInfo) Json

func (e *ExecutorInfo) Json() string

func (*ExecutorInfo) LoadFromJson

func (e *ExecutorInfo) LoadFromJson(json string) error

type JobResources

type JobResources []*ResourceInfo

func (JobResources) Len

func (rs JobResources) Len() int

func (JobResources) Less

func (rs JobResources) Less(i, j int) bool

func (JobResources) Swap

func (rs JobResources) Swap(i, j int)

type LoadResources

type LoadResources []*ResourceInfo

func (LoadResources) Len

func (rs LoadResources) Len() int

func (LoadResources) Less

func (rs LoadResources) Less(i, j int) bool

func (LoadResources) Swap

func (rs LoadResources) Swap(i, j int)

type MemoryResources

type MemoryResources []*ResourceInfo

func (MemoryResources) Len

func (rs MemoryResources) Len() int

func (MemoryResources) Less

func (rs MemoryResources) Less(i, j int) bool

func (MemoryResources) Swap

func (rs MemoryResources) Swap(i, j int)

type NodeInfo

type NodeInfo struct {
	NodeID    string
	Cluster   string
	Host      string
	Port      string
	OuterHost string
	OuterPort string
	Executors []string
	IsMaster  bool
	IsWorker  bool
	IsOnline  bool
}

func (*NodeInfo) EndPoint

func (n *NodeInfo) EndPoint() string

func (*NodeInfo) GetEmptyResource

func (n *NodeInfo) GetEmptyResource() *ResourceInfo

func (*NodeInfo) GetNodeKey

func (n *NodeInfo) GetNodeKey(clusterId string) string

func (*NodeInfo) Json

func (n *NodeInfo) Json() string

func (*NodeInfo) LoadFromJson

func (n *NodeInfo) LoadFromJson(json string) error

type PageInfo

type PageInfo struct {
	PageIndex int
	PageSize  int
}

type ResourceInfo

type ResourceInfo struct {
	EndPoint   string
	CpuRate    int //cpu rate, refresh per 1 minute
	MemoryRate int //memory rate, refresh per 1 minute
	TaskCount  int //job count
	LoadValue  int //load value = cpu * 30 + memory * 30 + jobs * 40
}

func (*ResourceInfo) RefreshLoadValue

func (r *ResourceInfo) RefreshLoadValue() int

refreshLoadValue refresh resource's load value

type Result

type Result struct {
	RetCode int
	RetMsg  string
	Error   error
}

func ErrorResult

func ErrorResult(err error) *Result

func FailedResult

func FailedResult(retCode int, retMsg string) *Result

func NewResult

func NewResult(retCode int, retMsg string, err error) *Result

func SuccessResult

func SuccessResult() *Result

func (*Result) IsSuccess

func (r *Result) IsSuccess() bool

func (*Result) Message

func (r *Result) Message() string

type TaskConfig

type TaskConfig struct {
	TaskID         string
	TaskType       string
	IsRun          bool
	Handler        task.TaskHandle `json:"-"`
	DueTime        int64
	Interval       int64
	Express        string
	TaskData       interface{}
	HAFlag         bool //HA flag, if set true, leader will watch it, when it offline will resubmit
	TargetType     string
	TargetConfig   interface{}
	DistributeType int
}

Jump to

Keyboard shortcuts

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