worker

package
v0.0.0-...-5dfe74e Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Worker_CreateJob_FullMethodName   = "/eolymp.worker.Worker/CreateJob"
	Worker_DescribeJob_FullMethodName = "/eolymp.worker.Worker/DescribeJob"
	Worker_ListJobs_FullMethodName    = "/eolymp.worker.Worker/ListJobs"
)
View Source
const (
	WorkerService_CreateJob_FullMethodName   = "/eolymp.worker.WorkerService/CreateJob"
	WorkerService_DescribeJob_FullMethodName = "/eolymp.worker.WorkerService/DescribeJob"
	WorkerService_ListJobs_FullMethodName    = "/eolymp.worker.WorkerService/ListJobs"
)

Variables

View Source
var (
	Job_Status_name = map[int32]string{
		0: "UNKNOWN",
		1: "CREATED",
		2: "STARTED",
		3: "COMPLETE",
		4: "ERROR",
	}
	Job_Status_value = map[string]int32{
		"UNKNOWN":  0,
		"CREATED":  1,
		"STARTED":  2,
		"COMPLETE": 3,
		"ERROR":    4,
	}
)

Enum value maps for Job_Status.

View Source
var File_eolymp_worker_events_proto protoreflect.FileDescriptor
View Source
var File_eolymp_worker_job_proto protoreflect.FileDescriptor
View Source
var File_eolymp_worker_worker_service_proto protoreflect.FileDescriptor
View Source
var WorkerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "eolymp.worker.WorkerService",
	HandlerType: (*WorkerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateJob",
			Handler:    _WorkerService_CreateJob_Handler,
		},
		{
			MethodName: "DescribeJob",
			Handler:    _WorkerService_DescribeJob_Handler,
		},
		{
			MethodName: "ListJobs",
			Handler:    _WorkerService_ListJobs_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "eolymp/worker/worker_service.proto",
}

WorkerService_ServiceDesc is the grpc.ServiceDesc for WorkerService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var Worker_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "eolymp.worker.Worker",
	HandlerType: (*WorkerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateJob",
			Handler:    _Worker_CreateJob_Handler,
		},
		{
			MethodName: "DescribeJob",
			Handler:    _Worker_DescribeJob_Handler,
		},
		{
			MethodName: "ListJobs",
			Handler:    _Worker_ListJobs_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "eolymp/worker/worker_service.proto",
}

Worker_ServiceDesc is the grpc.ServiceDesc for Worker service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterWorkerHttpHandlers

func RegisterWorkerHttpHandlers(router *mux.Router, prefix string, cli WorkerClient)

RegisterWorkerHttpHandlers adds handlers for for WorkerClient This constructor creates http.Handler, the actual implementation might change at any moment

func RegisterWorkerServer

func RegisterWorkerServer(s grpc.ServiceRegistrar, srv WorkerServer)

func RegisterWorkerServiceHttpHandlers

func RegisterWorkerServiceHttpHandlers(router *mux.Router, prefix string, cli WorkerServiceClient)

RegisterWorkerServiceHttpHandlers adds handlers for for WorkerServiceClient This constructor creates http.Handler, the actual implementation might change at any moment

func RegisterWorkerServiceServer

func RegisterWorkerServiceServer(s grpc.ServiceRegistrar, srv WorkerServiceServer)

Types

type CreateJobInput

type CreateJobInput struct {
	Type   string            `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Inputs map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*CreateJobInput) Descriptor deprecated

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

Deprecated: Use CreateJobInput.ProtoReflect.Descriptor instead.

func (*CreateJobInput) GetInputs

func (x *CreateJobInput) GetInputs() map[string]string

func (*CreateJobInput) GetType

func (x *CreateJobInput) GetType() string

func (*CreateJobInput) ProtoMessage

func (*CreateJobInput) ProtoMessage()

func (*CreateJobInput) ProtoReflect

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

func (*CreateJobInput) Reset

func (x *CreateJobInput) Reset()

func (*CreateJobInput) String

func (x *CreateJobInput) String() string

type CreateJobOutput

type CreateJobOutput struct {
	JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateJobOutput) Descriptor deprecated

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

Deprecated: Use CreateJobOutput.ProtoReflect.Descriptor instead.

func (*CreateJobOutput) GetJobId

func (x *CreateJobOutput) GetJobId() string

func (*CreateJobOutput) ProtoMessage

func (*CreateJobOutput) ProtoMessage()

func (*CreateJobOutput) ProtoReflect

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

func (*CreateJobOutput) Reset

func (x *CreateJobOutput) Reset()

func (*CreateJobOutput) String

func (x *CreateJobOutput) String() string

type DescribeJobInput

type DescribeJobInput struct {
	JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DescribeJobInput) Descriptor deprecated

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

Deprecated: Use DescribeJobInput.ProtoReflect.Descriptor instead.

func (*DescribeJobInput) GetJobId

func (x *DescribeJobInput) GetJobId() string

func (*DescribeJobInput) ProtoMessage

func (*DescribeJobInput) ProtoMessage()

func (*DescribeJobInput) ProtoReflect

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

func (*DescribeJobInput) Reset

func (x *DescribeJobInput) Reset()

func (*DescribeJobInput) String

func (x *DescribeJobInput) String() string

type DescribeJobOutput

type DescribeJobOutput struct {
	Job *Job `protobuf:"bytes,1,opt,name=job,proto3" json:"job,omitempty"`
	// contains filtered or unexported fields
}

func (*DescribeJobOutput) Descriptor deprecated

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

Deprecated: Use DescribeJobOutput.ProtoReflect.Descriptor instead.

func (*DescribeJobOutput) GetJob

func (x *DescribeJobOutput) GetJob() *Job

func (*DescribeJobOutput) ProtoMessage

func (*DescribeJobOutput) ProtoMessage()

func (*DescribeJobOutput) ProtoReflect

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

func (*DescribeJobOutput) Reset

func (x *DescribeJobOutput) Reset()

func (*DescribeJobOutput) String

func (x *DescribeJobOutput) String() string

type Job

type Job struct {
	Id         string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Type       string                 `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Inputs     map[string]string      `` /* 153-byte string literal not displayed */
	CreatedAt  *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	StartedAt  *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
	ProgressAt *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=progress_at,json=progressAt,proto3" json:"progress_at,omitempty"`
	CompleteAt *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=complete_at,json=completeAt,proto3" json:"complete_at,omitempty"`
	// progress is a number from 0 to `total`, showing amount of work complete
	Progress uint32            `protobuf:"varint,20,opt,name=progress,proto3" json:"progress,omitempty"`
	Total    uint32            `protobuf:"varint,21,opt,name=total,proto3" json:"total,omitempty"`
	Status   Job_Status        `protobuf:"varint,30,opt,name=status,proto3,enum=eolymp.worker.Job_Status" json:"status,omitempty"`
	Outputs  map[string]string `` /* 156-byte string literal not displayed */
	Logs     string            `protobuf:"bytes,100,opt,name=logs,proto3" json:"logs,omitempty"`
	// contains filtered or unexported fields
}

func (*Job) Descriptor deprecated

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

Deprecated: Use Job.ProtoReflect.Descriptor instead.

func (*Job) GetCompleteAt

func (x *Job) GetCompleteAt() *timestamppb.Timestamp

func (*Job) GetCreatedAt

func (x *Job) GetCreatedAt() *timestamppb.Timestamp

func (*Job) GetId

func (x *Job) GetId() string

func (*Job) GetInputs

func (x *Job) GetInputs() map[string]string

func (*Job) GetLogs

func (x *Job) GetLogs() string

func (*Job) GetOutputs

func (x *Job) GetOutputs() map[string]string

func (*Job) GetProgress

func (x *Job) GetProgress() uint32

func (*Job) GetProgressAt

func (x *Job) GetProgressAt() *timestamppb.Timestamp

func (*Job) GetStartedAt

func (x *Job) GetStartedAt() *timestamppb.Timestamp

func (*Job) GetStatus

func (x *Job) GetStatus() Job_Status

func (*Job) GetTotal

func (x *Job) GetTotal() uint32

func (*Job) GetType

func (x *Job) GetType() string

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

type JobTriggerEvent

type JobTriggerEvent struct {
	Job *Job `protobuf:"bytes,1,opt,name=job,proto3" json:"job,omitempty"`
	// contains filtered or unexported fields
}

func (*JobTriggerEvent) Descriptor deprecated

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

Deprecated: Use JobTriggerEvent.ProtoReflect.Descriptor instead.

func (*JobTriggerEvent) GetJob

func (x *JobTriggerEvent) GetJob() *Job

func (*JobTriggerEvent) ProtoMessage

func (*JobTriggerEvent) ProtoMessage()

func (*JobTriggerEvent) ProtoReflect

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

func (*JobTriggerEvent) Reset

func (x *JobTriggerEvent) Reset()

func (*JobTriggerEvent) String

func (x *JobTriggerEvent) String() string

type Job_Status

type Job_Status int32
const (
	Job_UNKNOWN  Job_Status = 0
	Job_CREATED  Job_Status = 1
	Job_STARTED  Job_Status = 2
	Job_COMPLETE Job_Status = 3
	Job_ERROR    Job_Status = 4
)

func (Job_Status) Descriptor

func (Job_Status) Descriptor() protoreflect.EnumDescriptor

func (Job_Status) Enum

func (x Job_Status) Enum() *Job_Status

func (Job_Status) EnumDescriptor deprecated

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

Deprecated: Use Job_Status.Descriptor instead.

func (Job_Status) Number

func (x Job_Status) Number() protoreflect.EnumNumber

func (Job_Status) String

func (x Job_Status) String() string

func (Job_Status) Type

type ListJobsInput

type ListJobsInput struct {

	// pagination
	Offset int32 `protobuf:"varint,10,opt,name=offset,proto3" json:"offset,omitempty"`
	Size   int32 `protobuf:"varint,11,opt,name=size,proto3" json:"size,omitempty"`
	// data filters
	Filters *ListJobsInput_Filter `protobuf:"bytes,40,opt,name=filters,proto3" json:"filters,omitempty"`
	// contains filtered or unexported fields
}

func (*ListJobsInput) Descriptor deprecated

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

Deprecated: Use ListJobsInput.ProtoReflect.Descriptor instead.

func (*ListJobsInput) GetFilters

func (x *ListJobsInput) GetFilters() *ListJobsInput_Filter

func (*ListJobsInput) GetOffset

func (x *ListJobsInput) GetOffset() int32

func (*ListJobsInput) GetSize

func (x *ListJobsInput) GetSize() int32

func (*ListJobsInput) ProtoMessage

func (*ListJobsInput) ProtoMessage()

func (*ListJobsInput) ProtoReflect

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

func (*ListJobsInput) Reset

func (x *ListJobsInput) Reset()

func (*ListJobsInput) String

func (x *ListJobsInput) String() string

type ListJobsInput_Filter

type ListJobsInput_Filter struct {
	Id     []*wellknown.ExpressionID   `protobuf:"bytes,1,rep,name=id,proto3" json:"id,omitempty"`
	Type   []*wellknown.ExpressionEnum `protobuf:"bytes,2,rep,name=type,proto3" json:"type,omitempty"`
	Status []*wellknown.ExpressionEnum `protobuf:"bytes,3,rep,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*ListJobsInput_Filter) Descriptor deprecated

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

Deprecated: Use ListJobsInput_Filter.ProtoReflect.Descriptor instead.

func (*ListJobsInput_Filter) GetId

func (*ListJobsInput_Filter) GetStatus

func (x *ListJobsInput_Filter) GetStatus() []*wellknown.ExpressionEnum

func (*ListJobsInput_Filter) GetType

func (*ListJobsInput_Filter) ProtoMessage

func (*ListJobsInput_Filter) ProtoMessage()

func (*ListJobsInput_Filter) ProtoReflect

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

func (*ListJobsInput_Filter) Reset

func (x *ListJobsInput_Filter) Reset()

func (*ListJobsInput_Filter) String

func (x *ListJobsInput_Filter) String() string

type ListJobsOutput

type ListJobsOutput struct {
	Total int32  `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	Items []*Job `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

func (*ListJobsOutput) Descriptor deprecated

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

Deprecated: Use ListJobsOutput.ProtoReflect.Descriptor instead.

func (*ListJobsOutput) GetItems

func (x *ListJobsOutput) GetItems() []*Job

func (*ListJobsOutput) GetTotal

func (x *ListJobsOutput) GetTotal() int32

func (*ListJobsOutput) ProtoMessage

func (*ListJobsOutput) ProtoMessage()

func (*ListJobsOutput) ProtoReflect

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

func (*ListJobsOutput) Reset

func (x *ListJobsOutput) Reset()

func (*ListJobsOutput) String

func (x *ListJobsOutput) String() string

type UnimplementedWorkerServer

type UnimplementedWorkerServer struct {
}

UnimplementedWorkerServer should be embedded to have forward compatible implementations.

func (UnimplementedWorkerServer) CreateJob

func (UnimplementedWorkerServer) DescribeJob

func (UnimplementedWorkerServer) ListJobs

type UnimplementedWorkerServiceServer

type UnimplementedWorkerServiceServer struct {
}

UnimplementedWorkerServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedWorkerServiceServer) CreateJob

func (UnimplementedWorkerServiceServer) DescribeJob

func (UnimplementedWorkerServiceServer) ListJobs

type UnsafeWorkerServer

type UnsafeWorkerServer interface {
	// contains filtered or unexported methods
}

UnsafeWorkerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkerServer will result in compilation errors.

type UnsafeWorkerServiceServer

type UnsafeWorkerServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeWorkerServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkerServiceServer will result in compilation errors.

type WorkerClient

type WorkerClient interface {
	CreateJob(ctx context.Context, in *CreateJobInput, opts ...grpc.CallOption) (*CreateJobOutput, error)
	DescribeJob(ctx context.Context, in *DescribeJobInput, opts ...grpc.CallOption) (*DescribeJobOutput, error)
	ListJobs(ctx context.Context, in *ListJobsInput, opts ...grpc.CallOption) (*ListJobsOutput, error)
}

WorkerClient is the client API for Worker service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewWorkerClient

func NewWorkerClient(cc grpc.ClientConnInterface) WorkerClient

type WorkerInterceptor

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

func NewWorkerInterceptor

func NewWorkerInterceptor(cli WorkerClient, middleware ..._WorkerMiddleware) *WorkerInterceptor

NewWorkerInterceptor constructs additional middleware for a server based on annotations in proto files

func (*WorkerInterceptor) CreateJob

func (*WorkerInterceptor) DescribeJob

func (*WorkerInterceptor) ListJobs

type WorkerServer

type WorkerServer interface {
	CreateJob(context.Context, *CreateJobInput) (*CreateJobOutput, error)
	DescribeJob(context.Context, *DescribeJobInput) (*DescribeJobOutput, error)
	ListJobs(context.Context, *ListJobsInput) (*ListJobsOutput, error)
}

WorkerServer is the server API for Worker service. All implementations should embed UnimplementedWorkerServer for forward compatibility

type WorkerService

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

func NewWorkerHttpClient

func NewWorkerHttpClient(url string, cli _WorkerHttpClient) *WorkerService

NewWorkerHttpClient constructs client for Worker

func (*WorkerService) CreateJob

func (s *WorkerService) CreateJob(ctx context.Context, in *CreateJobInput) (*CreateJobOutput, error)

func (*WorkerService) DescribeJob

func (*WorkerService) ListJobs

func (s *WorkerService) ListJobs(ctx context.Context, in *ListJobsInput) (*ListJobsOutput, error)

type WorkerServiceClient

type WorkerServiceClient interface {
	CreateJob(ctx context.Context, in *CreateJobInput, opts ...grpc.CallOption) (*CreateJobOutput, error)
	DescribeJob(ctx context.Context, in *DescribeJobInput, opts ...grpc.CallOption) (*DescribeJobOutput, error)
	ListJobs(ctx context.Context, in *ListJobsInput, opts ...grpc.CallOption) (*ListJobsOutput, error)
}

WorkerServiceClient is the client API for WorkerService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type WorkerServiceInterceptor

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

func NewWorkerServiceInterceptor

func NewWorkerServiceInterceptor(cli WorkerServiceClient, middleware ..._WorkerServiceMiddleware) *WorkerServiceInterceptor

NewWorkerServiceInterceptor constructs additional middleware for a server based on annotations in proto files

func (*WorkerServiceInterceptor) CreateJob

func (*WorkerServiceInterceptor) DescribeJob

func (*WorkerServiceInterceptor) ListJobs

type WorkerServiceServer

type WorkerServiceServer interface {
	CreateJob(context.Context, *CreateJobInput) (*CreateJobOutput, error)
	DescribeJob(context.Context, *DescribeJobInput) (*DescribeJobOutput, error)
	ListJobs(context.Context, *ListJobsInput) (*ListJobsOutput, error)
}

WorkerServiceServer is the server API for WorkerService service. All implementations should embed UnimplementedWorkerServiceServer for forward compatibility

type WorkerServiceService

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

func NewWorkerServiceHttpClient

func NewWorkerServiceHttpClient(url string, cli _WorkerServiceHttpClient) *WorkerServiceService

NewWorkerServiceHttpClient constructs client for WorkerService

func (*WorkerServiceService) CreateJob

func (*WorkerServiceService) DescribeJob

func (*WorkerServiceService) ListJobs

Jump to

Keyboard shortcuts

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