scarf

package module
v0.0.0-...-e285db0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 7 Imported by: 0

README

Scarf logo

Scarf GoDoc CircleCI Coverage Status

gRPC server framework built on top of nacelle.


Documentation coming soon.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TokenClientID   = tokenClientID("scarf.client_id")
	TokenRemoteAddr = tokenRemoteAddr("scarf.remote_addr")
)

Functions

func BootAndExit

func BootAndExit(name string, endpointSet EndpointSet)

BootAndExit creates a nacelle Bootstrapper with the given name and initializes and starts a gRPC server with the given endpoint set. This method does not return.

func GetClientID

func GetClientID(ctx context.Context) string

func GetRemoteAddr

func GetRemoteAddr(ctx context.Context) string

func NewServer

func NewServer(endpointSet EndpointSet) nacelle.Process

func NewStatsHandler

func NewStatsHandler(handler stats.Handler) stats.Handler

func PopulateClientIDField

func PopulateClientIDField(ctx context.Context, fields nacelle.LogFields)

func PopulateRemoteAddrField

func PopulateRemoteAddrField(ctx context.Context, fields nacelle.LogFields)

Types

type EndpointSet

type EndpointSet interface {
	Init(nacelle.Config, *grpc.Server) error
	Middleware() []Middleware
}

type Middleware

type Middleware interface {
	Init() error

	// ApplyUnary decorates a UnaryHandler.
	ApplyUnary(grpc.UnaryHandler, *grpc.UnaryServerInfo) (grpc.UnaryHandler, error)

	// ApplyStream decorates a UnaryHandler.
	ApplyStream(grpc.StreamHandler, *grpc.StreamServerInfo) (grpc.StreamHandler, error)
}

Middleware transforms unary and stream handlers into a decorated handler.

type StatsHandler

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

func (*StatsHandler) HandleConn

func (h *StatsHandler) HandleConn(ctx context.Context, stats stats.ConnStats)

func (*StatsHandler) HandleRPC

func (h *StatsHandler) HandleRPC(ctx context.Context, stats stats.RPCStats)

func (*StatsHandler) TagConn

func (h *StatsHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context

func (*StatsHandler) TagRPC

func (h *StatsHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context

Directories

Path Synopsis
examples
simple/proto
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.
stream/proto
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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