bottom

package
v0.0.0-...-3185076 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(configPath string)

func Setup

func Setup() *cobra.Command

func SetupHTTPServer

func SetupHTTPServer(responder Responder)

Types

type Bottom

type Bottom struct {
	ThreadCount int
	Actions     chan func()
	Tracer      trace.Tracer

	bottomProto.UnimplementedBottomServer
}

func NewBottom

func NewBottom(threadCount int, stop <-chan struct{}) *Bottom

func (*Bottom) Error

func (w *Bottom) Error(writer http.ResponseWriter, r *http.Request, err error, statusCode int)

func (*Bottom) NotFound

func (w *Bottom) NotFound(writer http.ResponseWriter, r *http.Request)

func (*Bottom) RunFunction

func (*Bottom) RunFunctionHttp

func (w *Bottom) RunFunctionHttp(ctx context.Context, f *Function) (*FunctionResult, error)

type Client

type Client struct {
	HttpClient http.Client
	ServerURL  string
	Tracer     trace.Tracer
}

func NewClient

func NewClient(tracer trace.Tracer, serverHost string, serverPort int) *Client

func NewClientFromURL

func NewClientFromURL(tracer trace.Tracer, serverURL string) *Client

func (*Client) RunFunction

func (c *Client) RunFunction(methodContext context.Context, f *Function) (*FunctionResult, error)

type Config

type Config struct {
	Port        int
	JaegerURL   string
	ThreadCount int
	GRPCPort    int
}

type Function

type Function struct {
	Name string
	Args []int
}

type FunctionResult

type FunctionResult struct {
	Value int
}

type GRPCClient

type GRPCClient struct {
	Connection *grpc.ClientConn
	Client     bottomProto.BottomClient
}

func NewGRPCClient

func NewGRPCClient(tracer trace.Tracer, serverHost string, serverPort int) (*GRPCClient, error)

func (*GRPCClient) RunFunction

func (g *GRPCClient) RunFunction(methodContext context.Context, f *Function) (*FunctionResult, error)

type GRPCServer

type GRPCServer struct {
	Port   int
	Server *grpc.Server
}

func NewGRPCServer

func NewGRPCServer(port int, bottom *Bottom) (*GRPCServer, error)

type Number

type Number interface {
	int64 | float64 | int
}

type Responder

type Responder interface {
	RunFunctionHttp(ctx context.Context, function *Function) (*FunctionResult, error)

	NotFound(w http.ResponseWriter, r *http.Request)
	Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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