lava

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCtxWithClientInfo

func CreateCtxWithClientInfo(ctx context.Context, info *lavapbv1.ServiceInfo) context.Context

func CreateCtxWithReqID

func CreateCtxWithReqID(ctx context.Context, reqId string) context.Context

func CreateCtxWithServerInfo

func CreateCtxWithServerInfo(ctx context.Context, info *lavapbv1.ServiceInfo) context.Context

func CreateReqHeader

func CreateReqHeader(ctx context.Context, header *RequestHeader) context.Context

func CreateRspHeader

func CreateRspHeader(ctx context.Context, header *ResponseHeader) context.Context

func GetClientInfo

func GetClientInfo(ctx context.Context) *lavapbv1.ServiceInfo

func GetReqID

func GetReqID(ctx context.Context) string

func GetServerInfo

func GetServerInfo(ctx context.Context) *lavapbv1.ServiceInfo

Types

type Annotation

type Annotation interface {
	Name() string
}

Annotation is used to attach arbitrary metadata to the schema objects

type Annotations

type Annotations = []Annotation

type Close

type Close interface {
	Close()
}

type GrpcGatewayRouter

type GrpcGatewayRouter interface {
	GrpcRouter
	RegisterGateway(ctx context.Context, mux *runtime.ServeMux, conn grpc.ClientConnInterface) error
}

type GrpcRouter

type GrpcRouter interface {
	Middlewares() []Middleware
	ServiceDesc() *grpc.ServiceDesc
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, req Request) (Response, error)

type HttpRouter

type HttpRouter interface {
	Middlewares() []Middleware
	Router(router fiber.Router)
	Prefix() string
}

type Init

type Init interface {
	Init()
}

type Initializer

type Initializer interface {
	Initialize()
}

Initializer ...

type InnerServer

type InnerServer struct {
	grpc.ClientConnInterface
}

type Middleware

type Middleware interface {
	Middleware(next HandlerFunc) HandlerFunc
	String() string
}

func Chain

func Chain(m ...Middleware) Middleware

type MiddlewareWrap

type MiddlewareWrap struct {
	Next func(next HandlerFunc) HandlerFunc
	Name string
}

func (MiddlewareWrap) Middleware

func (m MiddlewareWrap) Middleware(next HandlerFunc) HandlerFunc

func (MiddlewareWrap) String

func (m MiddlewareWrap) String() string

type Middlewares

type Middlewares []Middleware

type Request

type Request interface {
	// Client server or client
	Client() bool

	// Kind [http|grpc...]
	Kind() string

	// Stream Indicates whether it's a stream
	Stream() bool

	// Service name requested
	Service() string

	// Operation requested
	Operation() string

	// Endpoint requested
	Endpoint() string

	// ContentType Content type provided
	ContentType() string

	// Header of the request
	Header() *RequestHeader

	// Payload is the decoded value
	Payload() interface{}
}

Request is a synchronous request interface

type RequestHeader

type RequestHeader = fasthttp.RequestHeader

func ReqHeader

func ReqHeader(ctx context.Context) *RequestHeader

type Response

type Response interface {
	Header() *ResponseHeader
	Payload() interface{}
	Stream() bool
}

Response is the response writer for un encoded messages

type ResponseHeader

type ResponseHeader = fasthttp.ResponseHeader

func RspHeader

func RspHeader(ctx context.Context) *ResponseHeader

type Server

type Server interface {
	Serve(context.Context, net.Listener) error
}

Server provides an interface for starting and stopping the server.

type Service

type Service interface {
	Start()
	Stop()
	Run()
}

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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