server

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 18 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Restate

type Restate struct {
	// contains filtered or unexported fields
}

Restate represents a Restate HTTP handler to which services or virtual objects may be attached.

func NewRestate

func NewRestate() *Restate

NewRestate creates a new instance of Restate server

func (*Restate) Bidirectional added in v0.9.1

func (r *Restate) Bidirectional(bidi bool) *Restate

Bidirectional is used to change the protocol mode advertised to Restate on discovery In bidirectional mode, Restate will keep the request body open even after we have started to respond, allowing for more work to be done without suspending. This is supported over HTTP2 and, in some cases (where there is no buffering proxy), with HTTP1.1. When serving over a non-bidirectional channel (eg, Lambda), use .WithBidirectional(false) otherwise your handlers may get stuck.

func (*Restate) Bind

func (r *Restate) Bind(router restate.Router) *Restate

Bind attaches a Router (a Service or Virtual Object) to this server

func (*Restate) Handler added in v0.9.1

func (r *Restate) Handler() (http.HandlerFunc, error)

Handler obtains a http.HandlerFunc representing the bound routers which can be passed to other types of server. Ensure that .Bidirectional(false) is set when serving over a channel that doesn't support full-duplex request and response.

func (*Restate) Start

func (r *Restate) Start(ctx context.Context, address string) error

Start starts a HTTP2 server serving the bound routers

func (*Restate) WithIdentityV1

func (r *Restate) WithIdentityV1(keys ...string) *Restate

WithIdentityV1 attaches v1 request identity public keys to this server. All incoming requests will be validated against one of these keys.

func (*Restate) WithLogger

func (r *Restate) WithLogger(h slog.Handler, dropReplayLogs bool) *Restate

WithLogger overrides the slog handler used by the SDK (which defaults to the slog Default()) You may specify with dropReplayLogs whether to drop logs that originated from handler code while the invocation was replaying. If they are not dropped, you may still determine the replay status in a slog.Handler using github.com/restatedev/sdk-go/rcontext.LogContextFrom

Jump to

Keyboard shortcuts

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