Documentation ¶
Index ¶
- Constants
- func GetFullMethodNameFromContext(ctx context.Context) string
- func NotYetImplementedError(msg string) error
- func RunOrExit(configure func(c *ServerConfig) error, port int)
- func UnauthenticatedError() error
- func ValidationError(msg string) error
- type ConfigureFunc
- type Interceptor
- type Module
- type ServerConfig
- func (*ServerConfig) AddMethodRequestInterceptor(methodName string, interceptor Interceptor)
- func (*ServerConfig) AddMethodResponseInterceptor(methodName string, interceptor Interceptor)
- func (*ServerConfig) AddRequestInterceptor(interceptor Interceptor)
- func (*ServerConfig) AddResponseInterceptor(interceptor Interceptor)
- func (s *ServerConfig) GetGRPCServer() *grpc.Server
- func (s *ServerConfig) InstallModule(module Module)
- type Service
Constants ¶
const FullMethodNameCtxKey = "fullMethodName"
FullMethodNameCtxKey is the key of the full method name in the context passed into interceptor functions. This allows interceptor functions to access the full method name from `ctx`.
Variables ¶
This section is empty.
Functions ¶
func GetFullMethodNameFromContext ¶
GetFullMethodNameFromContext gets the full method name from the context passed into an interceptor function.
func NotYetImplementedError ¶
NotYetImplementedError returns an UNIMPLEMNTED error plus a message.
func RunOrExit ¶
func RunOrExit(configure func(c *ServerConfig) error, port int)
RunOrExit runs the provided gRPC server on the specified port. `configure` is a function that can be used to set up resources and configure the server before running.
func UnauthenticatedError ¶
func UnauthenticatedError() error
UnauthenticatedError returns an UNAUTHENTICATED error.
func ValidationError ¶
ValidationError returns an INVALID_ARGUMENT error plus a message.
Types ¶
type ConfigureFunc ¶
type ConfigureFunc func(c *ServerConfig) error
ConfigureFunc is a function that is used to set up an Aether server. It is passed a pointer to a ServerConfig, which can be used to add interceptors, register services, and more.
type Interceptor ¶
Interceptor is a function that is run before a request or after a response.
type Module ¶
type Module interface { // Configure is a function that will be called as Aether sets up the server. Configure is passed // a pointer to a ServerConfig, which can be used to add interceptors, register gRPC services, and more. Configure(c *ServerConfig) error Name() string }
Module is an interface that represents an Aether Module. A module is a self-contained, reuseable piece of functionality that servers can install. It is the fundamental building block of an Aether server.
type ServerConfig ¶
type ServerConfig struct {
// contains filtered or unexported fields
}
func (*ServerConfig) AddMethodRequestInterceptor ¶
func (*ServerConfig) AddMethodRequestInterceptor(methodName string, interceptor Interceptor)
AddMethodRequestInterceptor adds a function that will be called with an incoming request before the specified method is called. Interceptors are called in FIFO order: interceptors added first will be called first. The `methodName` is the full RPC method string, i.e., /package.service/method.
func (*ServerConfig) AddMethodResponseInterceptor ¶
func (*ServerConfig) AddMethodResponseInterceptor(methodName string, interceptor Interceptor)
AddMethodResponseInterceptor adds a function that will be called with an outgoing response from a specified method before it's sent to the caller. Interceptors are called in FIFO order: interceptors added first will be called first.
func (*ServerConfig) AddRequestInterceptor ¶
func (*ServerConfig) AddRequestInterceptor(interceptor Interceptor)
AddRequestInterceptor adds a function that will be called with an incoming request before the handler is called. Interceptors are called in FIFO order: interceptors added first will be called first.
func (*ServerConfig) AddResponseInterceptor ¶
func (*ServerConfig) AddResponseInterceptor(interceptor Interceptor)
AddResponseInterceptor adds a function that will be called with an outgoing response before it's sent to the caller. Interceptors are called in FIFO order: interceptors added first will be called first.
func (*ServerConfig) GetGRPCServer ¶
func (s *ServerConfig) GetGRPCServer() *grpc.Server
GetGRPCServer gets a reference to the current gRPC server. Useful for registering services.
func (*ServerConfig) InstallModule ¶
func (s *ServerConfig) InstallModule(module Module)
InstallModule installs an Aether Module on the current server.
type Service ¶
type Service interface { Service() interface{} ServiceDesc() *grpc.ServiceDesc }