server

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServer

func GetServer(path string, opts ...Option) (svr interfaces.GrpcServer, err error)

func HandleError

func HandleError(err error) (res *grpc.Response, err2 error)

func HandleSuccess

func HandleSuccess() (res *grpc.Response, err error)

func HandleSuccessWithData

func HandleSuccessWithData(data interface{}) (res *grpc.Response, err error)

func HandleSuccessWithListData

func HandleSuccessWithListData(data interface{}, total int) (res *grpc.Response, err error)

func NewServer

func NewServer(opts ...Option) (svr2 interfaces.GrpcServer, err error)

func ProvideGetServer

func ProvideGetServer(path string, opts ...Option) func() (svr interfaces.GrpcServer, err error)

func ProvideMessageServer

func ProvideMessageServer(server interfaces.GrpcServer, opts ...MessageServerOption) func() (res *MessageServer, err error)

func ProvideNodeServer

func ProvideNodeServer(server interfaces.GrpcServer, opts ...NodeServerOption) func() (res *NodeServer, err error)

func ProvidePluginServer

func ProvidePluginServer(server interfaces.GrpcServer, opts ...PluginServerOption) func() (res *PluginServer, err error)

func ProvideServer

func ProvideServer(path string, opts ...Option) func() (res interfaces.GrpcServer, err error)

func ProvideTaskServer

func ProvideTaskServer(server interfaces.GrpcServer, opts ...TaskServerOption) func() (res *TaskServer, err error)

Types

type MessageServer

type MessageServer struct {
	grpc.UnimplementedMessageServiceServer
	// contains filtered or unexported fields
}

func NewMessageServer

func NewMessageServer(opts ...MessageServerOption) (res *MessageServer, err error)

func (MessageServer) Connect

func (svr MessageServer) Connect(stream grpc.MessageService_ConnectServer) (err error)

type MessageServerOption

type MessageServerOption func(svr *MessageServer)

func WithServerMessageServerService

func WithServerMessageServerService(server interfaces.GrpcServer) MessageServerOption

type ModelBaseServiceBinder

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

func NewModelBaseServiceBinder

func NewModelBaseServiceBinder(req *grpc.Request) (b *ModelBaseServiceBinder)

func (*ModelBaseServiceBinder) Bind

func (*ModelBaseServiceBinder) BindWithBaseServiceMessage

func (b *ModelBaseServiceBinder) BindWithBaseServiceMessage() (params *entity.GrpcBaseServiceParams, msg interfaces.GrpcModelBaseServiceMessage, err error)

func (*ModelBaseServiceBinder) MustBind

func (b *ModelBaseServiceBinder) MustBind() (res interface{})

type ModelBaseServiceServer

type ModelBaseServiceServer struct {
	grpc.UnimplementedModelBaseServiceServer
	// contains filtered or unexported fields
}

func NewModelBaseServiceServer

func NewModelBaseServiceServer() (svr2 *ModelBaseServiceServer, err error)

func (ModelBaseServiceServer) Count

func (svr ModelBaseServiceServer) Count(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) Delete

func (svr ModelBaseServiceServer) Delete(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) DeleteById

func (svr ModelBaseServiceServer) DeleteById(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) DeleteList

func (svr ModelBaseServiceServer) DeleteList(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) ForceDeleteList

func (svr ModelBaseServiceServer) ForceDeleteList(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) Get

func (svr ModelBaseServiceServer) Get(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) GetById

func (svr ModelBaseServiceServer) GetById(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) GetList

func (svr ModelBaseServiceServer) GetList(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) Insert

func (svr ModelBaseServiceServer) Insert(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) Update

func (svr ModelBaseServiceServer) Update(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) UpdateById

func (svr ModelBaseServiceServer) UpdateById(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

func (ModelBaseServiceServer) UpdateDoc

func (svr ModelBaseServiceServer) UpdateDoc(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

type ModelDelegateBinder

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

func NewModelDelegateBinder

func NewModelDelegateBinder(req *grpc.Request) (b *ModelDelegateBinder)

func (*ModelDelegateBinder) Bind

func (b *ModelDelegateBinder) Bind() (res interface{}, err error)

func (*ModelDelegateBinder) BindWithDelegateMessage

func (b *ModelDelegateBinder) BindWithDelegateMessage() (res interface{}, msg interfaces.GrpcModelDelegateMessage, err error)

func (*ModelDelegateBinder) MustBind

func (b *ModelDelegateBinder) MustBind() (res interface{})

type ModelDelegateServer

type ModelDelegateServer struct {
	grpc.UnimplementedModelDelegateServer
}

func NewModelDelegateServer

func NewModelDelegateServer() (svr *ModelDelegateServer)

func (ModelDelegateServer) Do

func (svr ModelDelegateServer) Do(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

Do and perform an RPC action of constants.Delegate

type NodeServer

type NodeServer struct {
	grpc.UnimplementedNodeServiceServer
	// contains filtered or unexported fields
}

func NewNodeServer

func NewNodeServer(opts ...NodeServerOption) (res *NodeServer, err error)

func (NodeServer) Ping

func (svr NodeServer) Ping(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

Ping from worker to master

func (NodeServer) Register

func (svr NodeServer) Register(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

Register from handler/worker to master

func (NodeServer) SendHeartbeat

func (svr NodeServer) SendHeartbeat(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

SendHeartbeat from worker to master

func (NodeServer) Subscribe

func (svr NodeServer) Subscribe(request *grpc.Request, stream grpc.NodeService_SubscribeServer) (err error)

func (NodeServer) Unsubscribe

func (svr NodeServer) Unsubscribe(ctx context.Context, req *grpc.Request) (res *grpc.Response, err error)

type NodeServerOption

type NodeServerOption func(svr *NodeServer)

func WithServerNodeServerService

func WithServerNodeServerService(server interfaces.GrpcServer) NodeServerOption

type Option

type Option func(svr interfaces.GrpcServer)

func WithAddress

func WithAddress(address interfaces.Address) Option

func WithConfigPath

func WithConfigPath(path string) Option

type PluginServer

type PluginServer struct {
	grpc.UnimplementedPluginServiceServer
	// contains filtered or unexported fields
}

func NewPluginServer

func NewPluginServer(opts ...PluginServerOption) (res *PluginServer, err error)

func (PluginServer) Poll

func (svr PluginServer) Poll(stream grpc.PluginService_PollServer) (err error)

func (PluginServer) Register

func (svr PluginServer) Register(ctx context.Context, req *grpc.PluginRequest) (res *grpc.Response, err error)

func (PluginServer) Subscribe

func (svr PluginServer) Subscribe(req *grpc.PluginRequest, stream grpc.PluginService_SubscribeServer) (err error)

type PluginServerOption

type PluginServerOption func(svr *PluginServer)

func WithServerPluginServerService

func WithServerPluginServerService(server interfaces.GrpcServer) PluginServerOption

type Server

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

func (*Server) DeleteSubscribe

func (svr *Server) DeleteSubscribe(key string)

func (*Server) GetConfigPath

func (svr *Server) GetConfigPath() (path string)

func (*Server) GetSubscribe

func (svr *Server) GetSubscribe(key string) (sub interfaces.GrpcSubscribe, err error)

func (*Server) Init

func (svr *Server) Init() (err error)

func (*Server) IsStopped

func (svr *Server) IsStopped() (res bool)

func (*Server) Register

func (svr *Server) Register() (err error)

func (*Server) SendStreamMessage

func (svr *Server) SendStreamMessage(key string, code grpc2.StreamMessageCode) (err error)

func (*Server) SendStreamMessageWithData

func (svr *Server) SendStreamMessageWithData(key string, code grpc2.StreamMessageCode, d interface{}) (err error)

func (*Server) SetAddress

func (svr *Server) SetAddress(address interfaces.Address)

func (*Server) SetConfigPath

func (svr *Server) SetConfigPath(path string)

func (*Server) SetSubscribe

func (svr *Server) SetSubscribe(key string, sub interfaces.GrpcSubscribe)

func (*Server) Start

func (svr *Server) Start() (err error)

func (*Server) Stop

func (svr *Server) Stop() (err error)

type TaskServer

type TaskServer struct {
	grpc.UnimplementedTaskServiceServer
	// contains filtered or unexported fields
}

func NewTaskServer

func NewTaskServer(opts ...TaskServerOption) (res *TaskServer, err error)

func (TaskServer) Fetch added in v0.6.1

func (svr TaskServer) Fetch(ctx context.Context, request *grpc.Request) (response *grpc.Response, err error)

Fetch tasks to be executed by a task handler

func (TaskServer) Subscribe

func (svr TaskServer) Subscribe(stream grpc.TaskService_SubscribeServer) (err error)

Subscribe to task stream when a task runner in a node starts

type TaskServerOption

type TaskServerOption func(svr *TaskServer)

func WithServerTaskServerService

func WithServerTaskServerService(server interfaces.GrpcServer) TaskServerOption

Jump to

Keyboard shortcuts

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