Documentation ¶
Index ¶
- Variables
- func DealRPCErr(err error) error
- func DoStopConn(mode define.RunMode)
- func Init() error
- func Init2() error
- func InitWorker()
- func NewgRPCServer(mode define.RunMode) (*grpc.Server, error)
- func RecvEvent()
- func RegistryClient(version string, port int)
- type Auth
- type EventData
- type HeartbeatService
- type LogCache
- func (l *LogCache) Clean()
- func (l *LogCache) Close()
- func (l *LogCache) Get() interface{}
- func (l *LogCache) GetCode() int
- func (l *LogCache) GetTaskStatus() define.TaskStatus
- func (l *LogCache) ReadAll() (p string)
- func (l *LogCache) ReadOnly(p []byte, off int) (n int, err error)
- func (l *LogCache) Save(data interface{})
- func (l *LogCache) SetTaskStatus(status define.TaskStatus)
- func (l *LogCache) Write(p []byte) (n int, err error)
- func (l *LogCache) WriteString(p string) (n int, err error)
- func (l *LogCache) WriteStringf(tmpl string, args ...interface{}) (n int, err error)
- type LogCacher
- type Next
- type TaskEvent
- type TaskService
Constants ¶
This section is empty.
Variables ¶
var (
// Cron schedule loop
Cron *cacheSchedule
)
var (
// Cron2 schedule loop
Cron2 *cacheSchedule2
)
var ( // ErrNoGetLog get real log from redis where no data ErrNoGetLog = errors.New("no read data from cache") )
var ( // ErrNoReadData define when read offset rather than len(bug), return this error ErrNoReadData = errors.New("no read data from cache") )
Functions ¶
func DoStopConn ¶
DoStopConn will cancel all running task and close grpc conn
func NewgRPCServer ¶
NewgRPCServer new gRPC server
func RegistryClient ¶
RegistryClient registry client to server
Types ¶
type Auth ¶
type Auth struct {
SecretToken string
}
Auth check rpc request valid
func (*Auth) GetRequestMetadata ¶
GetRequestMetadata implement PerRPCCredentials interface
func (*Auth) RequireTransportSecurity ¶
RequireTransportSecurity indicates whether the credentials requires transport security.
type EventData ¶ added in v1.1.0
type EventData struct { TaskID string // task id TE TaskEvent // task event: add change delete stop task }
EventData sub data from redis 应用于调度节点集群,当添加任务、删除修改任务、终止任务时, 所有的集群调度节点都会接收到信息,然后进行相应的修改操作
type HeartbeatService ¶
type HeartbeatService struct {
Auth Auth
}
HeartbeatService implementation proto Heartbeat interface
func (*HeartbeatService) RegistryHost ¶
func (hs *HeartbeatService) RegistryHost(ctx context.Context, req *pb.RegistryReq) (*pb.Empty, error)
RegistryHost client registry
func (*HeartbeatService) SendHb ¶
func (hs *HeartbeatService) SendHb(ctx context.Context, hb *pb.HeartbeatReq) (*pb.Empty, error)
SendHb recv heatneat from client
type LogCache ¶
type LogCache struct {
// contains filtered or unexported fields
}
LogCache otehr could read latest data from buf and do not clean it
func (*LogCache) GetTaskStatus ¶
func (l *LogCache) GetTaskStatus() define.TaskStatus
GetTaskStatus will be set task status is running or stop
func (*LogCache) SetTaskStatus ¶
func (l *LogCache) SetTaskStatus(status define.TaskStatus)
SetTaskStatus will be set task status is running or stop
func (*LogCache) WriteString ¶
WriteString Write String to buf
type LogCacher ¶
type LogCacher interface { // Read byte, but it not clean reader data // ReadOnly read data from buf // 从off后开始读,最多可以读取len(p)个字节, // - close为true,返回0,EOF // - off > len(l.buf),返回 noreaddata 这时读取方重新读取可以等待一会 // - off+len(p) > len(l.buf),返回 p.buf.Len-off,nil // - off+len(p) < len(l.buf),返回 len(p), nil ReadOnly(p []byte, off int) (n int, err error) // Write byte buf Write(p []byte) (n int, err error) // Write byte buf,do not use it write recv task WriteString(p string) (n int, err error) // WriteStringf ,do not use it write recv task WriteStringf(tmpl string, args ...interface{}) (n int, err error) // Close will can not Read, and clean buf Clean() // Close will stop task Close() // ReadAll data from buf ReadAll() (p string) // GetCode return task return code GetCode() int // SetRunHost save task run host Save(interface{}) // GetRunHost task run host addr Get() interface{} // SetTaskStatus set task status // wait running finish fail cancel SetTaskStatus(define.TaskStatus) GetTaskStatus() define.TaskStatus }
LogCacher Write buf,ReadOnly from buf a stream write and read
type Next ¶
Next will return next run host if Next is nil,because not find valid host
func GetRoutePolicy ¶
func GetRoutePolicy(hgid string, routepolicy define.RoutePolicy) Next
GetRoutePolicy return a type Next, it will return a host
type TaskService ¶
type TaskService struct {
Auth Auth
}
TaskService implementation proto task interface
func (*TaskService) RunTask ¶
func (ts *TaskService) RunTask(req *pb.TaskReq, stream pb.Task_RunTaskServer) error
RunTask run task by rpc if start run,every output must be output by stream.Send return err must be err