Documentation ¶
Overview ¶
Package app encapsulates the client, server and other interfaces to provide a complete dapp
Index ¶
- func New(opts ...Option) *nitroProgram
- type Option
- func AddInterval(t time.Duration) Option
- func AddTTL(t time.Duration) Option
- func Address(addr string) Option
- func AfterStart(fn func() error) Option
- func AfterStop(fn func() error) Option
- func BeforeStart(fn func() error) Option
- func BeforeStop(fn func() error) Option
- func Broker(b event.Broker) Option
- func Client(c client.Client) Option
- func Context(ctx context.Context) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func Registry(r registry.Table) Option
- func Server(s server.Server) Option
- func Transport(t network.Transport) Option
- func Version(v string) Option
- func WrapCall(w ...client.CallWrapper) Option
- func WrapClient(w ...client.Wrapper) Option
- func WrapHandler(w ...server.HandlerWrapper) Option
- func WrapSubscriber(w ...server.SubscriberWrapper) Option
- type Options
- type Program
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
func AddInterval ¶
AddInterval specifies the interval on which to re-register
func AfterStart ¶
func BeforeStart ¶
func BeforeStop ¶
func Context ¶
Context specifies a context for the app. Can be used to signal shutdown of the app. Can be used for extra option values.
func WrapCall ¶
func WrapCall(w ...client.CallWrapper) Option
WrapCall is a convenience method for wrapping a Client CallFunc
func WrapClient ¶
WrapClient is a convenience method for wrapping a Client with some middleware component. A list of wrappers can be provided. Wrappers are applied in reverse order so the last is executed first.
func WrapHandler ¶
func WrapHandler(w ...server.HandlerWrapper) Option
WrapHandler adds a handler Wrapper to a list of options passed into the server
func WrapSubscriber ¶
func WrapSubscriber(w ...server.SubscriberWrapper) Option
WrapSubscriber adds a subscriber Wrapper to a list of options passed into the server
type Options ¶
type Options struct { Broker event.Broker Registry registry.Table // Before and After funcs BeforeStart []func() error BeforeStop []func() error AfterStart []func() error AfterStop []func() error // Other options for implementations of the interface // can be stored in a context Context context.Context Client client.Client Server server.Server }
type Program ¶
type Program interface { // Set the current application name Name(string) // Execute a function in a remote program Execute(prog, fn string, req, rsp interface{}) error // Broadcast an event to subscribers Broadcast(event string, msg interface{}) error // Register a function e.g a public Go struct/method with signature func(context.Context, *Request, *Response) error Register(fn interface{}) error // Subscribe to broadcast events. Signature is public Go func or struct with signature func(context.Context, *Message) error Subscribe(event string, fn interface{}) error // Run the application program Run() error }
Program is an interface for distributed application programming
Directories ¶
Path | Synopsis |
---|---|
Package client is an interface for an RPC client
|
Package client is an interface for an RPC client |
rpc
Package rpc provides a network agnostic RPC client
|
Package rpc provides a network agnostic RPC client |
Package codec is an interface for encoding messages
|
Package codec is an interface for encoding messages |
bytes
Package bytes provides a bytes codec which does not encode or decode anything
|
Package bytes provides a bytes codec which does not encode or decode anything |
json
Package json provides a json codec
|
Package json provides a json codec |
jsonrpc
Package jsonrpc provides a json-rpc 1.0 codec
|
Package jsonrpc provides a json-rpc 1.0 codec |
Package crypto provides authentication and authorization capability
|
Package crypto provides authentication and authorization capability |
Package errors provides a way to return detailed information for an RPC request error.
|
Package errors provides a way to return detailed information for an RPC request error. |
Package event is an interface used for asynchronous messaging
|
Package event is an interface used for asynchronous messaging |
nats
Package memory provides a memory event
|
Package memory provides a memory event |
Package db is an interface for data storage
|
Package db is an interface for data storage |
file
Package memory is a in-memory db.store
|
Package memory is a in-memory db.store |
Package log provides a log interface
|
Package log provides a log interface |
Package metadata is a way of defining message headers
|
Package metadata is a way of defining message headers |
Package network is an interface for synchronous connection based communication
|
Package network is an interface for synchronous connection based communication |
socket
Package socket provides a net socket network
|
Package socket provides a net socket network |
Package registry is an interface for service discovery
|
Package registry is an interface for service discovery |
table
Package memory provides an in-memory registry
|
Package memory provides an in-memory registry |
Package router provides a network routing control plane
|
Package router provides a network routing control plane |
Package server is an interface for a micro server
|
Package server is an interface for a micro server |