job

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "UNKNOWN",
		1: "PENDING",
		2: "RUNNING",
		3: "COMPLETE",
		4: "FAILED",
	}
	Status_value = map[string]int32{
		"UNKNOWN":  0,
		"PENDING":  1,
		"RUNNING":  2,
		"COMPLETE": 3,
		"FAILED":   4,
	}
)

Enum value maps for Status.

View Source
var (
	Job_TaskStrategy_name = map[int32]string{
		0: "SERIAL",
		1: "PARALLEL",
	}
	Job_TaskStrategy_value = map[string]int32{
		"SERIAL":   0,
		"PARALLEL": 1,
	}
)

Enum value maps for Job_TaskStrategy.

View Source
var File_job_job_proto protoreflect.FileDescriptor

Functions

func RegisterTimerServer

func RegisterTimerServer(s *grpc.Server, srv TimerServer)

Types

type InquireJobRequest

type InquireJobRequest struct {

	// app_id 应用id
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	// job_id job id
	JobId string `protobuf:"bytes,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// contains filtered or unexported fields
}

InquireJobRequest 检查job状态请求

func (*InquireJobRequest) Descriptor deprecated

func (*InquireJobRequest) Descriptor() ([]byte, []int)

Deprecated: Use InquireJobRequest.ProtoReflect.Descriptor instead.

func (*InquireJobRequest) GetAppId

func (x *InquireJobRequest) GetAppId() string

func (*InquireJobRequest) GetJobId

func (x *InquireJobRequest) GetJobId() string

func (*InquireJobRequest) ProtoMessage

func (*InquireJobRequest) ProtoMessage()

func (*InquireJobRequest) ProtoReflect

func (x *InquireJobRequest) ProtoReflect() protoreflect.Message

func (*InquireJobRequest) Reset

func (x *InquireJobRequest) Reset()

func (*InquireJobRequest) String

func (x *InquireJobRequest) String() string

func (*InquireJobRequest) Validate

func (m *InquireJobRequest) Validate() error

Validate checks the field values on InquireJobRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type InquireJobRequestValidationError

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

InquireJobRequestValidationError is the validation error returned by InquireJobRequest.Validate if the designated constraints aren't met.

func (InquireJobRequestValidationError) Cause

Cause function returns cause value.

func (InquireJobRequestValidationError) Error

Error satisfies the builtin error interface

func (InquireJobRequestValidationError) ErrorName

ErrorName returns error name.

func (InquireJobRequestValidationError) Field

Field function returns field value.

func (InquireJobRequestValidationError) Key

Key function returns key value.

func (InquireJobRequestValidationError) Reason

Reason function returns reason value.

type InquireJobResponse

type InquireJobResponse struct {

	// id 定时器内部id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// job 工作内容
	Job *Job `protobuf:"bytes,2,opt,name=job,proto3" json:"job,omitempty"`
	// status job状态
	Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=job.Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

InquireJobResponse 检查job状态响应

func (*InquireJobResponse) Descriptor deprecated

func (*InquireJobResponse) Descriptor() ([]byte, []int)

Deprecated: Use InquireJobResponse.ProtoReflect.Descriptor instead.

func (*InquireJobResponse) GetId

func (x *InquireJobResponse) GetId() string

func (*InquireJobResponse) GetJob

func (x *InquireJobResponse) GetJob() *Job

func (*InquireJobResponse) GetStatus

func (x *InquireJobResponse) GetStatus() Status

func (*InquireJobResponse) ProtoMessage

func (*InquireJobResponse) ProtoMessage()

func (*InquireJobResponse) ProtoReflect

func (x *InquireJobResponse) ProtoReflect() protoreflect.Message

func (*InquireJobResponse) Reset

func (x *InquireJobResponse) Reset()

func (*InquireJobResponse) String

func (x *InquireJobResponse) String() string

func (*InquireJobResponse) Validate

func (m *InquireJobResponse) Validate() error

Validate checks the field values on InquireJobResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type InquireJobResponseValidationError

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

InquireJobResponseValidationError is the validation error returned by InquireJobResponse.Validate if the designated constraints aren't met.

func (InquireJobResponseValidationError) Cause

Cause function returns cause value.

func (InquireJobResponseValidationError) Error

Error satisfies the builtin error interface

func (InquireJobResponseValidationError) ErrorName

ErrorName returns error name.

func (InquireJobResponseValidationError) Field

Field function returns field value.

func (InquireJobResponseValidationError) Key

Key function returns key value.

func (InquireJobResponseValidationError) Reason

Reason function returns reason value.

type InquireTaskRequest

type InquireTaskRequest struct {

	// app_id 应用id
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	// job_id job id
	TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// contains filtered or unexported fields
}

InquireTaskRequest 查询task请求

func (*InquireTaskRequest) Descriptor deprecated

func (*InquireTaskRequest) Descriptor() ([]byte, []int)

Deprecated: Use InquireTaskRequest.ProtoReflect.Descriptor instead.

func (*InquireTaskRequest) GetAppId

func (x *InquireTaskRequest) GetAppId() string

func (*InquireTaskRequest) GetTaskId

func (x *InquireTaskRequest) GetTaskId() string

func (*InquireTaskRequest) ProtoMessage

func (*InquireTaskRequest) ProtoMessage()

func (*InquireTaskRequest) ProtoReflect

func (x *InquireTaskRequest) ProtoReflect() protoreflect.Message

func (*InquireTaskRequest) Reset

func (x *InquireTaskRequest) Reset()

func (*InquireTaskRequest) String

func (x *InquireTaskRequest) String() string

func (*InquireTaskRequest) Validate

func (m *InquireTaskRequest) Validate() error

Validate checks the field values on InquireTaskRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type InquireTaskRequestValidationError

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

InquireTaskRequestValidationError is the validation error returned by InquireTaskRequest.Validate if the designated constraints aren't met.

func (InquireTaskRequestValidationError) Cause

Cause function returns cause value.

func (InquireTaskRequestValidationError) Error

Error satisfies the builtin error interface

func (InquireTaskRequestValidationError) ErrorName

ErrorName returns error name.

func (InquireTaskRequestValidationError) Field

Field function returns field value.

func (InquireTaskRequestValidationError) Key

Key function returns key value.

func (InquireTaskRequestValidationError) Reason

Reason function returns reason value.

type InquireTaskResponse

type InquireTaskResponse struct {

	// id 定时器内部id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// task 任务内容
	Task *Task `protobuf:"bytes,2,opt,name=task,proto3" json:"task,omitempty"`
	// status task状态
	Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=job.Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

InquireTaskResponse 查询task响应

func (*InquireTaskResponse) Descriptor deprecated

func (*InquireTaskResponse) Descriptor() ([]byte, []int)

Deprecated: Use InquireTaskResponse.ProtoReflect.Descriptor instead.

func (*InquireTaskResponse) GetId

func (x *InquireTaskResponse) GetId() string

func (*InquireTaskResponse) GetStatus

func (x *InquireTaskResponse) GetStatus() Status

func (*InquireTaskResponse) GetTask

func (x *InquireTaskResponse) GetTask() *Task

func (*InquireTaskResponse) ProtoMessage

func (*InquireTaskResponse) ProtoMessage()

func (*InquireTaskResponse) ProtoReflect

func (x *InquireTaskResponse) ProtoReflect() protoreflect.Message

func (*InquireTaskResponse) Reset

func (x *InquireTaskResponse) Reset()

func (*InquireTaskResponse) String

func (x *InquireTaskResponse) String() string

func (*InquireTaskResponse) Validate

func (m *InquireTaskResponse) Validate() error

Validate checks the field values on InquireTaskResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type InquireTaskResponseValidationError

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

InquireTaskResponseValidationError is the validation error returned by InquireTaskResponse.Validate if the designated constraints aren't met.

func (InquireTaskResponseValidationError) Cause

Cause function returns cause value.

func (InquireTaskResponseValidationError) Error

Error satisfies the builtin error interface

func (InquireTaskResponseValidationError) ErrorName

ErrorName returns error name.

func (InquireTaskResponseValidationError) Field

Field function returns field value.

func (InquireTaskResponseValidationError) Key

Key function returns key value.

func (InquireTaskResponseValidationError) Reason

Reason function returns reason value.

type Job

type Job struct {

	// job_id 任务id,在同个app_id下需要保证任务id的唯一性
	JobId string `protobuf:"bytes,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// expire 执行时间
	Expire *common.Expire `protobuf:"bytes,3,opt,name=expire,proto3" json:"expire,omitempty"`
	// tasks 需要执行的任务
	Tasks []*Task `protobuf:"bytes,4,rep,name=tasks,proto3" json:"tasks,omitempty"`
	// task_strategy 当tasks超过1个时,指定执行策略
	TaskStrategy Job_TaskStrategy `protobuf:"varint,5,opt,name=task_strategy,json=taskStrategy,proto3,enum=job.Job_TaskStrategy" json:"task_strategy,omitempty"`
	// contains filtered or unexported fields
}

func (*Job) Descriptor deprecated

func (*Job) Descriptor() ([]byte, []int)

Deprecated: Use Job.ProtoReflect.Descriptor instead.

func (*Job) GetExpire

func (x *Job) GetExpire() *common.Expire

func (*Job) GetJobId

func (x *Job) GetJobId() string

func (*Job) GetTaskStrategy

func (x *Job) GetTaskStrategy() Job_TaskStrategy

func (*Job) GetTasks

func (x *Job) GetTasks() []*Task

func (*Job) ProtoMessage

func (*Job) ProtoMessage()

func (*Job) ProtoReflect

func (x *Job) ProtoReflect() protoreflect.Message

func (*Job) Reset

func (x *Job) Reset()

func (*Job) String

func (x *Job) String() string

func (*Job) Validate

func (m *Job) Validate() error

Validate checks the field values on Job with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type JobValidationError

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

JobValidationError is the validation error returned by Job.Validate if the designated constraints aren't met.

func (JobValidationError) Cause

func (e JobValidationError) Cause() error

Cause function returns cause value.

func (JobValidationError) Error

func (e JobValidationError) Error() string

Error satisfies the builtin error interface

func (JobValidationError) ErrorName

func (e JobValidationError) ErrorName() string

ErrorName returns error name.

func (JobValidationError) Field

func (e JobValidationError) Field() string

Field function returns field value.

func (JobValidationError) Key

func (e JobValidationError) Key() bool

Key function returns key value.

func (JobValidationError) Reason

func (e JobValidationError) Reason() string

Reason function returns reason value.

type Job_TaskStrategy

type Job_TaskStrategy int32

TaskStrategy 任务执行策略

const (
	// SERIAL 串行执行
	Job_SERIAL Job_TaskStrategy = 0
	// PARALLEL 并行执行
	Job_PARALLEL Job_TaskStrategy = 1
)

func (Job_TaskStrategy) Descriptor

func (Job_TaskStrategy) Enum

func (Job_TaskStrategy) EnumDescriptor deprecated

func (Job_TaskStrategy) EnumDescriptor() ([]byte, []int)

Deprecated: Use Job_TaskStrategy.Descriptor instead.

func (Job_TaskStrategy) Number

func (Job_TaskStrategy) String

func (x Job_TaskStrategy) String() string

func (Job_TaskStrategy) Type

type PutTimerJobRequest

type PutTimerJobRequest struct {

	// app_id 应用id
	AppId string `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	// job 任务内容
	Job *Job `protobuf:"bytes,2,opt,name=job,proto3" json:"job,omitempty"`
	// callback 回调
	Callback *common.Target `protobuf:"bytes,3,opt,name=callback,proto3" json:"callback,omitempty"`
	// contains filtered or unexported fields
}

PutTimerJobRequest 设置计时任务请求

func (*PutTimerJobRequest) Descriptor deprecated

func (*PutTimerJobRequest) Descriptor() ([]byte, []int)

Deprecated: Use PutTimerJobRequest.ProtoReflect.Descriptor instead.

func (*PutTimerJobRequest) GetAppId

func (x *PutTimerJobRequest) GetAppId() string

func (*PutTimerJobRequest) GetCallback

func (x *PutTimerJobRequest) GetCallback() *common.Target

func (*PutTimerJobRequest) GetJob

func (x *PutTimerJobRequest) GetJob() *Job

func (*PutTimerJobRequest) ProtoMessage

func (*PutTimerJobRequest) ProtoMessage()

func (*PutTimerJobRequest) ProtoReflect

func (x *PutTimerJobRequest) ProtoReflect() protoreflect.Message

func (*PutTimerJobRequest) Reset

func (x *PutTimerJobRequest) Reset()

func (*PutTimerJobRequest) String

func (x *PutTimerJobRequest) String() string

func (*PutTimerJobRequest) Validate

func (m *PutTimerJobRequest) Validate() error

Validate checks the field values on PutTimerJobRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type PutTimerJobRequestValidationError

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

PutTimerJobRequestValidationError is the validation error returned by PutTimerJobRequest.Validate if the designated constraints aren't met.

func (PutTimerJobRequestValidationError) Cause

Cause function returns cause value.

func (PutTimerJobRequestValidationError) Error

Error satisfies the builtin error interface

func (PutTimerJobRequestValidationError) ErrorName

ErrorName returns error name.

func (PutTimerJobRequestValidationError) Field

Field function returns field value.

func (PutTimerJobRequestValidationError) Key

Key function returns key value.

func (PutTimerJobRequestValidationError) Reason

Reason function returns reason value.

type PutTimerJobResponse

type PutTimerJobResponse struct {

	// id 计时器内部唯一id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// status 任务状态
	Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=job.Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

PutTimerJobResponse 设置计时任务响应

func (*PutTimerJobResponse) Descriptor deprecated

func (*PutTimerJobResponse) Descriptor() ([]byte, []int)

Deprecated: Use PutTimerJobResponse.ProtoReflect.Descriptor instead.

func (*PutTimerJobResponse) GetId

func (x *PutTimerJobResponse) GetId() string

func (*PutTimerJobResponse) GetStatus

func (x *PutTimerJobResponse) GetStatus() Status

func (*PutTimerJobResponse) ProtoMessage

func (*PutTimerJobResponse) ProtoMessage()

func (*PutTimerJobResponse) ProtoReflect

func (x *PutTimerJobResponse) ProtoReflect() protoreflect.Message

func (*PutTimerJobResponse) Reset

func (x *PutTimerJobResponse) Reset()

func (*PutTimerJobResponse) String

func (x *PutTimerJobResponse) String() string

func (*PutTimerJobResponse) Validate

func (m *PutTimerJobResponse) Validate() error

Validate checks the field values on PutTimerJobResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type PutTimerJobResponseValidationError

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

PutTimerJobResponseValidationError is the validation error returned by PutTimerJobResponse.Validate if the designated constraints aren't met.

func (PutTimerJobResponseValidationError) Cause

Cause function returns cause value.

func (PutTimerJobResponseValidationError) Error

Error satisfies the builtin error interface

func (PutTimerJobResponseValidationError) ErrorName

ErrorName returns error name.

func (PutTimerJobResponseValidationError) Field

Field function returns field value.

func (PutTimerJobResponseValidationError) Key

Key function returns key value.

func (PutTimerJobResponseValidationError) Reason

Reason function returns reason value.

type Status

type Status int32

Status 运行状态

const (
	// UNKNOWN 未知状态
	Status_UNKNOWN Status = 0
	// PENDING 等待中
	Status_PENDING Status = 1
	// RUNNING 运行中
	Status_RUNNING Status = 2
	// COMPLETE 完成
	Status_COMPLETE Status = 3
	// FAILED 失败
	Status_FAILED Status = 4
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type Task

type Task struct {

	// task_id
	TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// target 任务触发时的worker地址
	Target *common.Target `protobuf:"bytes,11,opt,name=target,proto3" json:"target,omitempty"`
	// task_content 任务内容
	TaskContent *any.Any `protobuf:"bytes,2,opt,name=task_content,json=taskContent,proto3" json:"task_content,omitempty"`
	// last_task_result 上一个任务的执行结果(如果是串行执行,且task不是第一个时有值)
	LastTaskResult *any.Any `protobuf:"bytes,8,opt,name=last_task_result,json=lastTaskResult,proto3" json:"last_task_result,omitempty"`
	// result 执行结果
	Result *any.Any `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"`
	// reason 错误详情。如果status=FAILED,则需要回传错误信息
	Reason string `protobuf:"bytes,4,opt,name=reason,proto3" json:"reason,omitempty"`
	// job_id 任务id,在同个app_id下需要保证任务id的唯一性
	JobId string `protobuf:"bytes,5,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// id 内部调度需要使用这个id,在PutJob的时候不要带该ID,因为job_server在接收到请求时会生成一个ID
	Id string `protobuf:"bytes,6,opt,name=id,proto3" json:"id,omitempty"`
	// task_name 任务name
	TaskName string `protobuf:"bytes,7,opt,name=task_name,json=taskName,proto3" json:"task_name,omitempty"`
	// contains filtered or unexported fields
}

Task 任务

func (*Task) Descriptor deprecated

func (*Task) Descriptor() ([]byte, []int)

Deprecated: Use Task.ProtoReflect.Descriptor instead.

func (*Task) GetId

func (x *Task) GetId() string

func (*Task) GetJobId

func (x *Task) GetJobId() string

func (*Task) GetLastTaskResult

func (x *Task) GetLastTaskResult() *any.Any

func (*Task) GetReason

func (x *Task) GetReason() string

func (*Task) GetResult

func (x *Task) GetResult() *any.Any

func (*Task) GetTarget

func (x *Task) GetTarget() *common.Target

func (*Task) GetTaskContent

func (x *Task) GetTaskContent() *any.Any

func (*Task) GetTaskId

func (x *Task) GetTaskId() string

func (*Task) GetTaskName

func (x *Task) GetTaskName() string

func (*Task) ProtoMessage

func (*Task) ProtoMessage()

func (*Task) ProtoReflect

func (x *Task) ProtoReflect() protoreflect.Message

func (*Task) Reset

func (x *Task) Reset()

func (*Task) String

func (x *Task) String() string

func (*Task) Validate

func (m *Task) Validate() error

Validate checks the field values on Task with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type TaskValidationError

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

TaskValidationError is the validation error returned by Task.Validate if the designated constraints aren't met.

func (TaskValidationError) Cause

func (e TaskValidationError) Cause() error

Cause function returns cause value.

func (TaskValidationError) Error

func (e TaskValidationError) Error() string

Error satisfies the builtin error interface

func (TaskValidationError) ErrorName

func (e TaskValidationError) ErrorName() string

ErrorName returns error name.

func (TaskValidationError) Field

func (e TaskValidationError) Field() string

Field function returns field value.

func (TaskValidationError) Key

func (e TaskValidationError) Key() bool

Key function returns key value.

func (TaskValidationError) Reason

func (e TaskValidationError) Reason() string

Reason function returns reason value.

type TimerClient

type TimerClient interface {
	// PutTimerJob 设置计时任务
	PutTimerJob(ctx context.Context, in *PutTimerJobRequest, opts ...grpc.CallOption) (*PutTimerJobResponse, error)
	// InquireJob 检查job状态
	InquireJob(ctx context.Context, in *InquireJobRequest, opts ...grpc.CallOption) (*InquireJobResponse, error)
	// InquireTask 检查task状态
	InquireTask(ctx context.Context, in *InquireJobRequest, opts ...grpc.CallOption) (*InquireJobResponse, error)
}

TimerClient is the client API for Timer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTimerClient

func NewTimerClient(cc grpc.ClientConnInterface) TimerClient

type TimerServer

type TimerServer interface {
	// PutTimerJob 设置计时任务
	PutTimerJob(context.Context, *PutTimerJobRequest) (*PutTimerJobResponse, error)
	// InquireJob 检查job状态
	InquireJob(context.Context, *InquireJobRequest) (*InquireJobResponse, error)
	// InquireTask 检查task状态
	InquireTask(context.Context, *InquireJobRequest) (*InquireJobResponse, error)
}

TimerServer is the server API for Timer service.

type UnimplementedTimerServer

type UnimplementedTimerServer struct {
}

UnimplementedTimerServer can be embedded to have forward compatible implementations.

func (*UnimplementedTimerServer) InquireJob

func (*UnimplementedTimerServer) InquireTask

func (*UnimplementedTimerServer) PutTimerJob

Jump to

Keyboard shortcuts

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