Documentation
¶
Index ¶
- Constants
- func NewDefaultServer(apis []GrpcAPI, opts ...grpc.ServerOption) (mgrpc.RegisteredServer, error)
- func NewGrpcServer(opts ...Option) (mgrpc.RegisteredServer, error)
- func NewRawGrpcServer(apis []GrpcAPI, opts ...grpc.ServerOption) (*grpc.Server, error)
- type ApplicationContext
- type GrpcAPI
- type NewGrpcAPI
- type NewServer
- type Option
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
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 WithGrpcOptions ¶
func WithGrpcOptions(options ...grpc.ServerOption) Option
func WithNewServer ¶
Click to show internal directories.
Click to hide internal directories.