task

package
v0.0.0-...-ebe581b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package task is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTaskHandler

func RegisterTaskHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterTaskHandler registers the http handlers for service Task to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterTaskHandlerClient

func RegisterTaskHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TaskClient) error

RegisterTaskHandlerClient registers the http handlers for service Task to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TaskClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TaskClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TaskClient" to call the correct interceptors.

func RegisterTaskHandlerFromEndpoint

func RegisterTaskHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterTaskHandlerFromEndpoint is same as RegisterTaskHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterTaskHandlerServer

func RegisterTaskHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TaskServer) error

RegisterTaskHandlerServer registers the http handlers for service Task to "mux". UnaryRPC :call TaskServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTaskHandlerFromEndpoint instead.

func RegisterTaskServer

func RegisterTaskServer(s *grpc.Server, srv TaskServer)

Types

type DataForTask

type DataForTask struct {
	Owner                []byte   `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"`
	Executor             []byte   `protobuf:"bytes,2,opt,name=executor,proto3" json:"executor,omitempty"`
	DataID               string   `protobuf:"bytes,3,opt,name=dataID,proto3" json:"dataID,omitempty"`
	PsiLabel             string   `protobuf:"bytes,4,opt,name=psiLabel,proto3" json:"psiLabel,omitempty"`
	ConfirmedAt          int64    `protobuf:"varint,5,opt,name=confirmedAt,proto3" json:"confirmedAt,omitempty"`
	RejectedAt           int64    `protobuf:"varint,6,opt,name=rejectedAt,proto3" json:"rejectedAt,omitempty"`
	Address              string   `protobuf:"bytes,7,opt,name=address,proto3" json:"address,omitempty"`
	IsTagPart            bool     `protobuf:"varint,8,opt,name=isTagPart,proto3" json:"isTagPart,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

DataForTask is a message received from Executor

func (*DataForTask) Descriptor

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

func (*DataForTask) GetAddress

func (m *DataForTask) GetAddress() string

func (*DataForTask) GetConfirmedAt

func (m *DataForTask) GetConfirmedAt() int64

func (*DataForTask) GetDataID

func (m *DataForTask) GetDataID() string

func (*DataForTask) GetExecutor

func (m *DataForTask) GetExecutor() []byte

func (*DataForTask) GetIsTagPart

func (m *DataForTask) GetIsTagPart() bool

func (*DataForTask) GetOwner

func (m *DataForTask) GetOwner() []byte

func (*DataForTask) GetPsiLabel

func (m *DataForTask) GetPsiLabel() string

func (*DataForTask) GetRejectedAt

func (m *DataForTask) GetRejectedAt() int64

func (*DataForTask) ProtoMessage

func (*DataForTask) ProtoMessage()

func (*DataForTask) Reset

func (m *DataForTask) Reset()

func (*DataForTask) String

func (m *DataForTask) String() string

func (*DataForTask) XXX_DiscardUnknown

func (m *DataForTask) XXX_DiscardUnknown()

func (*DataForTask) XXX_Marshal

func (m *DataForTask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DataForTask) XXX_Merge

func (m *DataForTask) XXX_Merge(src proto.Message)

func (*DataForTask) XXX_Size

func (m *DataForTask) XXX_Size() int

func (*DataForTask) XXX_Unmarshal

func (m *DataForTask) XXX_Unmarshal(b []byte) error

type FLTask

type FLTask struct {
	TaskID               string             `protobuf:"bytes,1,opt,name=taskID,proto3" json:"taskID,omitempty"`
	Name                 string             `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Description          string             `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Requester            []byte             `protobuf:"bytes,4,opt,name=requester,proto3" json:"requester,omitempty"`
	DataSets             []*DataForTask     `protobuf:"bytes,5,rep,name=dataSets,proto3" json:"dataSets,omitempty"`
	AlgoParam            *common.TaskParams `protobuf:"bytes,6,opt,name=algoParam,proto3" json:"algoParam,omitempty"`
	Status               string             `protobuf:"bytes,7,opt,name=status,proto3" json:"status,omitempty"`
	ErrMessage           string             `protobuf:"bytes,8,opt,name=errMessage,proto3" json:"errMessage,omitempty"`
	Result               string             `protobuf:"bytes,9,opt,name=result,proto3" json:"result,omitempty"`
	PublishTime          int64              `protobuf:"varint,10,opt,name=publishTime,proto3" json:"publishTime,omitempty"`
	StartTime            int64              `protobuf:"varint,11,opt,name=startTime,proto3" json:"startTime,omitempty"`
	EndTime              int64              `protobuf:"varint,12,opt,name=endTime,proto3" json:"endTime,omitempty"`
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

FLTask is a message received from Executor and defines Federated Learning Task based on MPC

func (*FLTask) Descriptor

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

func (*FLTask) GetAlgoParam

func (m *FLTask) GetAlgoParam() *common.TaskParams

func (*FLTask) GetDataSets

func (m *FLTask) GetDataSets() []*DataForTask

func (*FLTask) GetDescription

func (m *FLTask) GetDescription() string

func (*FLTask) GetEndTime

func (m *FLTask) GetEndTime() int64

func (*FLTask) GetErrMessage

func (m *FLTask) GetErrMessage() string

func (*FLTask) GetName

func (m *FLTask) GetName() string

func (*FLTask) GetPublishTime

func (m *FLTask) GetPublishTime() int64

func (*FLTask) GetRequester

func (m *FLTask) GetRequester() []byte

func (*FLTask) GetResult

func (m *FLTask) GetResult() string

func (*FLTask) GetStartTime

func (m *FLTask) GetStartTime() int64

func (*FLTask) GetStatus

func (m *FLTask) GetStatus() string

func (*FLTask) GetTaskID

func (m *FLTask) GetTaskID() string

func (*FLTask) ProtoMessage

func (*FLTask) ProtoMessage()

func (*FLTask) Reset

func (m *FLTask) Reset()

func (*FLTask) String

func (m *FLTask) String() string

func (*FLTask) XXX_DiscardUnknown

func (m *FLTask) XXX_DiscardUnknown()

func (*FLTask) XXX_Marshal

func (m *FLTask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FLTask) XXX_Merge

func (m *FLTask) XXX_Merge(src proto.Message)

func (*FLTask) XXX_Size

func (m *FLTask) XXX_Size() int

func (*FLTask) XXX_Unmarshal

func (m *FLTask) XXX_Unmarshal(b []byte) error

type FLTasks

type FLTasks struct {
	FLTasks              []*FLTask `protobuf:"bytes,1,rep,name=fLTasks,proto3" json:"fLTasks,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

FLTasks is list of FLTasks received from Executor

func (*FLTasks) Descriptor

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

func (*FLTasks) GetFLTasks

func (m *FLTasks) GetFLTasks() []*FLTask

func (*FLTasks) ProtoMessage

func (*FLTasks) ProtoMessage()

func (*FLTasks) Reset

func (m *FLTasks) Reset()

func (*FLTasks) String

func (m *FLTasks) String() string

func (*FLTasks) XXX_DiscardUnknown

func (m *FLTasks) XXX_DiscardUnknown()

func (*FLTasks) XXX_Marshal

func (m *FLTasks) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FLTasks) XXX_Merge

func (m *FLTasks) XXX_Merge(src proto.Message)

func (*FLTasks) XXX_Size

func (m *FLTasks) XXX_Size() int

func (*FLTasks) XXX_Unmarshal

func (m *FLTasks) XXX_Unmarshal(b []byte) error

type GetTaskRequest

type GetTaskRequest struct {
	TaskID               string   `protobuf:"bytes,1,opt,name=taskID,proto3" json:"taskID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

GetTaskRequest is message sent to Executor server to get a task

func (*GetTaskRequest) Descriptor

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

func (*GetTaskRequest) GetTaskID

func (m *GetTaskRequest) GetTaskID() string

func (*GetTaskRequest) ProtoMessage

func (*GetTaskRequest) ProtoMessage()

func (*GetTaskRequest) Reset

func (m *GetTaskRequest) Reset()

func (*GetTaskRequest) String

func (m *GetTaskRequest) String() string

func (*GetTaskRequest) XXX_DiscardUnknown

func (m *GetTaskRequest) XXX_DiscardUnknown()

func (*GetTaskRequest) XXX_Marshal

func (m *GetTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetTaskRequest) XXX_Merge

func (m *GetTaskRequest) XXX_Merge(src proto.Message)

func (*GetTaskRequest) XXX_Size

func (m *GetTaskRequest) XXX_Size() int

func (*GetTaskRequest) XXX_Unmarshal

func (m *GetTaskRequest) XXX_Unmarshal(b []byte) error

type ListTaskRequest

type ListTaskRequest struct {
	PubKey               []byte   `protobuf:"bytes,1,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
	EPubKey              []byte   `protobuf:"bytes,2,opt,name=ePubKey,proto3" json:"ePubKey,omitempty"`
	Status               string   `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	TimeStart            int64    `protobuf:"varint,4,opt,name=timeStart,proto3" json:"timeStart,omitempty"`
	TimeEnd              int64    `protobuf:"varint,5,opt,name=timeEnd,proto3" json:"timeEnd,omitempty"`
	Limit                int64    `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

ListTaskRequest is message sent to Executor server to list tasks

func (*ListTaskRequest) Descriptor

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

func (*ListTaskRequest) GetEPubKey

func (m *ListTaskRequest) GetEPubKey() []byte

func (*ListTaskRequest) GetLimit

func (m *ListTaskRequest) GetLimit() int64

func (*ListTaskRequest) GetPubKey

func (m *ListTaskRequest) GetPubKey() []byte

func (*ListTaskRequest) GetStatus

func (m *ListTaskRequest) GetStatus() string

func (*ListTaskRequest) GetTimeEnd

func (m *ListTaskRequest) GetTimeEnd() int64

func (*ListTaskRequest) GetTimeStart

func (m *ListTaskRequest) GetTimeStart() int64

func (*ListTaskRequest) ProtoMessage

func (*ListTaskRequest) ProtoMessage()

func (*ListTaskRequest) Reset

func (m *ListTaskRequest) Reset()

func (*ListTaskRequest) String

func (m *ListTaskRequest) String() string

func (*ListTaskRequest) XXX_DiscardUnknown

func (m *ListTaskRequest) XXX_DiscardUnknown()

func (*ListTaskRequest) XXX_Marshal

func (m *ListTaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListTaskRequest) XXX_Merge

func (m *ListTaskRequest) XXX_Merge(src proto.Message)

func (*ListTaskRequest) XXX_Size

func (m *ListTaskRequest) XXX_Size() int

func (*ListTaskRequest) XXX_Unmarshal

func (m *ListTaskRequest) XXX_Unmarshal(b []byte) error

type PredictResponse

type PredictResponse struct {
	TaskID               string   `protobuf:"bytes,1,opt,name=taskID,proto3" json:"taskID,omitempty"`
	Payload              []byte   `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

PredictResponse is a message received from Executor

func (*PredictResponse) Descriptor

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

func (*PredictResponse) GetPayload

func (m *PredictResponse) GetPayload() []byte

func (*PredictResponse) GetTaskID

func (m *PredictResponse) GetTaskID() string

func (*PredictResponse) ProtoMessage

func (*PredictResponse) ProtoMessage()

func (*PredictResponse) Reset

func (m *PredictResponse) Reset()

func (*PredictResponse) String

func (m *PredictResponse) String() string

func (*PredictResponse) XXX_DiscardUnknown

func (m *PredictResponse) XXX_DiscardUnknown()

func (*PredictResponse) XXX_Marshal

func (m *PredictResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PredictResponse) XXX_Merge

func (m *PredictResponse) XXX_Merge(src proto.Message)

func (*PredictResponse) XXX_Size

func (m *PredictResponse) XXX_Size() int

func (*PredictResponse) XXX_Unmarshal

func (m *PredictResponse) XXX_Unmarshal(b []byte) error

type TaskClient

type TaskClient interface {
	// ListTask is provided by Executor server for Executor client to list tasks with filters.
	ListTask(ctx context.Context, in *ListTaskRequest, opts ...grpc.CallOption) (*FLTasks, error)
	// GetTaskById is provided by Executor server for Executor client to query a task.
	GetTaskById(ctx context.Context, in *GetTaskRequest, opts ...grpc.CallOption) (*FLTask, error)
	// GetPredictResult is provided by Executor server for Executor client to get prediction result.
	GetPredictResult(ctx context.Context, in *TaskRequest, opts ...grpc.CallOption) (*PredictResponse, error)
	// StartTask is for Executors to request remote ones to start a task.
	StartTask(ctx context.Context, in *TaskRequest, opts ...grpc.CallOption) (*TaskResponse, error)
}

TaskClient is the client API for Task service.

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

func NewTaskClient

func NewTaskClient(cc *grpc.ClientConn) TaskClient

type TaskRequest

type TaskRequest struct {
	PubKey               []byte   `protobuf:"bytes,1,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
	TaskID               string   `protobuf:"bytes,2,opt,name=taskID,proto3" json:"taskID,omitempty"`
	Signature            []byte   `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

TaskRequest is message sent between Executors to request to start a task.

func (*TaskRequest) Descriptor

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

func (*TaskRequest) GetPubKey

func (m *TaskRequest) GetPubKey() []byte

func (*TaskRequest) GetSignature

func (m *TaskRequest) GetSignature() []byte

func (*TaskRequest) GetTaskID

func (m *TaskRequest) GetTaskID() string

func (*TaskRequest) ProtoMessage

func (*TaskRequest) ProtoMessage()

func (*TaskRequest) Reset

func (m *TaskRequest) Reset()

func (*TaskRequest) String

func (m *TaskRequest) String() string

func (*TaskRequest) XXX_DiscardUnknown

func (m *TaskRequest) XXX_DiscardUnknown()

func (*TaskRequest) XXX_Marshal

func (m *TaskRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TaskRequest) XXX_Merge

func (m *TaskRequest) XXX_Merge(src proto.Message)

func (*TaskRequest) XXX_Size

func (m *TaskRequest) XXX_Size() int

func (*TaskRequest) XXX_Unmarshal

func (m *TaskRequest) XXX_Unmarshal(b []byte) error

type TaskResponse

type TaskResponse struct {
	TaskID               string   `protobuf:"bytes,2,opt,name=taskID,proto3" json:"taskID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

TaskResponse is a message received from Executor.

func (*TaskResponse) Descriptor

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

func (*TaskResponse) GetTaskID

func (m *TaskResponse) GetTaskID() string

func (*TaskResponse) ProtoMessage

func (*TaskResponse) ProtoMessage()

func (*TaskResponse) Reset

func (m *TaskResponse) Reset()

func (*TaskResponse) String

func (m *TaskResponse) String() string

func (*TaskResponse) XXX_DiscardUnknown

func (m *TaskResponse) XXX_DiscardUnknown()

func (*TaskResponse) XXX_Marshal

func (m *TaskResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TaskResponse) XXX_Merge

func (m *TaskResponse) XXX_Merge(src proto.Message)

func (*TaskResponse) XXX_Size

func (m *TaskResponse) XXX_Size() int

func (*TaskResponse) XXX_Unmarshal

func (m *TaskResponse) XXX_Unmarshal(b []byte) error

type TaskServer

type TaskServer interface {
	// ListTask is provided by Executor server for Executor client to list tasks with filters.
	ListTask(context.Context, *ListTaskRequest) (*FLTasks, error)
	// GetTaskById is provided by Executor server for Executor client to query a task.
	GetTaskById(context.Context, *GetTaskRequest) (*FLTask, error)
	// GetPredictResult is provided by Executor server for Executor client to get prediction result.
	GetPredictResult(context.Context, *TaskRequest) (*PredictResponse, error)
	// StartTask is for Executors to request remote ones to start a task.
	StartTask(context.Context, *TaskRequest) (*TaskResponse, error)
}

TaskServer is the server API for Task service.

type UnimplementedTaskServer

type UnimplementedTaskServer struct {
}

UnimplementedTaskServer can be embedded to have forward compatible implementations.

func (*UnimplementedTaskServer) GetPredictResult

func (*UnimplementedTaskServer) GetPredictResult(ctx context.Context, req *TaskRequest) (*PredictResponse, error)

func (*UnimplementedTaskServer) GetTaskById

func (*UnimplementedTaskServer) GetTaskById(ctx context.Context, req *GetTaskRequest) (*FLTask, error)

func (*UnimplementedTaskServer) ListTask

func (*UnimplementedTaskServer) StartTask

Jump to

Keyboard shortcuts

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