grpc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoField           = "field %s is not configured"
	ErrComponentNotFound = "component not found. kind: %v , name: %v"
)

Variables

This section is empty.

Functions

func NewDefaultServer

func NewDefaultServer(apis []GrpcAPI, opts ...grpc.ServerOption) (mgrpc.RegisteredServer, error)

func NewGrpcServer

func NewGrpcServer(opts ...Option) (mgrpc.RegisteredServer, error)

func NewRawGrpcServer added in v0.4.0

func NewRawGrpcServer(apis []GrpcAPI, opts ...grpc.ServerOption) (*grpc.Server, error)

Types

type ApplicationContext added in v0.4.0

type ApplicationContext struct {
	AppId                 string
	Hellos                map[string]hello.HelloService
	ConfigStores          map[string]configstores.Store
	Rpcs                  map[string]rpc.Invoker
	PubSubs               map[string]pubsub.PubSub
	StateStores           map[string]state.Store
	Files                 map[string]file.File
	Oss                   map[string]oss.Oss
	LockStores            map[string]lock.LockStore
	Sequencers            map[string]sequencer.Store
	SendToOutputBindingFn func(name string, req *bindings.InvokeRequest) (*bindings.InvokeResponse, error)
	SecretStores          map[string]secretstores.SecretStore
	DynamicComponents     map[lifecycle.ComponentKey]common.DynamicComponent
	CustomComponent       map[string]map[string]custom.Component
	CryptionService       map[string]cryption.CryptionService

	EmailService map[string]email.EmailService

	PhoneCallService map[string]phone.PhoneCallService

	SmsService map[string]sms.SmsService
}

ApplicationContext contains all you need to construct your GrpcAPI, such as all the components. For example, your "SuperState" GrpcAPI can hold the "StateStores" components and use them to implement your own "Super State API" logic.

type GrpcAPI added in v0.4.0

type GrpcAPI interface {
	// init this API before binding it to the grpc server.
	// For example,you can call app to query their subscriptions.
	Init(conn *grpc.ClientConn) error

	// Bind this API to the grpc server
	Register(rawGrpcServer *grpc.Server) error
}

GrpcAPI is the interface of API plugin. It has lifecycle related methods

type NewGrpcAPI added in v0.4.0

type NewGrpcAPI func(applicationContext *ApplicationContext) GrpcAPI

NewGrpcAPI is the constructor of GrpcAPI

type NewServer

type NewServer func(apis []GrpcAPI, opts ...grpc.ServerOption) (mgrpc.RegisteredServer, error)

type Option

type Option func(o *grpcOptions)

func WithGrpcAPIs added in v0.4.0

func WithGrpcAPIs(apis []GrpcAPI) Option

apis CANNOT be nil.

func WithGrpcOptions

func WithGrpcOptions(options ...grpc.ServerOption) Option

func WithNewServer

func WithNewServer(f NewServer) Option

Directories

Path Synopsis
extension
s3

Jump to

Keyboard shortcuts

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