scarf

package module
v0.0.0-...-1210efa Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 7 Imported by: 0

README

Scarf logo

Scarf

GoDoc Build Status Maintainability Test Coverage

Scarf is a gRPC API framework built on top of the concepts brought to you by nacelle. For example usage, see the examples directory.


Overview

TODO

License

Copyright (c) 2018 Eric Fritz

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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