libgrpc

package
v0.0.0-...-86e84b6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TimeType = "time.time"

Variables

View Source
var GrpcServer *grpc.Server

GrpcServer need to be call from the main file of the service, to launch the grpc server.

Functions

func NewServer

func NewServer(tracer opentracing.Tracer)

Types

type ActivityInterface

type ActivityInterface interface {
	MarshalArgs() ([]byte, error)
	UnmarshalArgs([]byte) error
	MarshalResult(interface{}) ([]byte, error)
	UnmarshalResult([]byte, interface{}) error
	Run(context.Context) (interface{}, error)
}

type ActivityRunInterface

type ActivityRunInterface interface {
}

type Arg

type Arg struct {
	Name     string
	Type     libdomain.PropertyType
	Required bool
}

Arg represent the argument of a custom function.

type ArgData

type ArgData struct {
	Name     string
	Title    string
	Type     string
	Required bool
	Arg      *Arg
}

ArgData represent the argument of a custom function, in a format usable by templates.

type CustomFunc

type CustomFunc struct {
	Name   string
	Args   []*Arg
	Result *Arg
}

CustomFunc represent a custom function.

func (*CustomFunc) GetCustomFuncData

func (c *CustomFunc) GetCustomFuncData() *CustomFuncData

GetCustomFuncData return the custom function information, in a format usable by templates.

type CustomFuncData

type CustomFuncData struct {
	Name   string
	Title  string
	Args   []*ArgData
	Result *ArgData
}

CustomFuncData represent a custom function, in a format usable by templates.

type Definition

type Definition struct {
	Application    libapplication.AggregateInterface
	GenDomain      string
	Create         *RequestConfig
	Update         *RequestConfig
	Delete         *RequestConfig
	CustomQueries  []*libdomain.CustomRequest
	CustomCommands []*libdomain.CustomRequest

	Event bool
	// contains filtered or unexported fields
}

Definition is used to declare the information of a model, so it can generate its code.

func (*Definition) CustomRequests

func (d *Definition) CustomRequests() []*libdomain.CustomRequest

func (*Definition) GetCustomFuncByName

func (d *Definition) GetCustomFuncByName(name string) *libdomain.CustomRequest

GetCustomFuncByName return the custom function by it's name

type Definitions

type Definitions struct {
	Prefix     string
	Repository string
	Tenant     bool
	Auth       bool
	// contains filtered or unexported fields
}

Definitions contains all the grpc definitions in the service.

func (*Definitions) GenClient

func (defs *Definitions) GenClient(path string)

GenClient will generate the grpc client files. nolint: dupl

func (*Definitions) GetByID

func (ds *Definitions) GetByID(id string) *Definition

GetByID return the specified definition by its ID.

func (*Definitions) Register

func (ds *Definitions) Register(d *Definition)

Register is used to register a new definition into the service.

func (*Definitions) Slice

func (ds *Definitions) Slice() []*Definition

Slice return the definitions as a slice.

type OrchestratorClient

type OrchestratorClient interface {
	ExecuteWorkflow(
		context.Context, *libdomain.AggregateDefinition, string, string,
		WorkflowInterface, StartWorkflowOptions) (WorkflowRunInterface, error)
	ExecuteActivity(*libdomain.Workflow, ActivityInterface) (ActivityRunInterface, error)
	InitOrchestratorRepository() error
}

type RequestConfig

type RequestConfig struct{}

type Server

type Server struct {
}

Server need to be call from the main file of the service, to launch the grpc server.

func (*Server) Listen

func (s *Server) Listen(port int) error

Listen start the grpc server on the specified port.

type StartWorkflowOptions

type StartWorkflowOptions struct {
	ID       string
	Model    string
	Function string
}

type WorkerInterface

type WorkerInterface interface {
	RegisterWorkflow(string, string, interface{}) error
	RegisterActivity(a interface{}) error
	Run(i <-chan interface{}) error
}

type WorkflowInterface

type WorkflowInterface interface {
	GetName() string
	MarshalArgs() ([]byte, error)
	UnmarshalArgs([]byte) error
	MarshalResult(interface{}) ([]byte, error)
	UnmarshalResult([]byte, interface{}) error
	Run(*libdomain.Workflow) (interface{}, error)
}

type WorkflowRunInterface

type WorkflowRunInterface interface {
	Get(context.Context) (interface{}, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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