laminar

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Laminar GoDoc Go Report Card

Laminar is a middlewares library for Goka heavily inspired by the certain functionality present in Go-Kit. Using Laminar, engineers familiar with go-kit should feel at home wriing Goka processors.

Motivation

Go has an excellent ecosystem and tradition of middlewares for HTTP processing. While a streaming application built with Goka is certainly not a web application, the patterns common there can be adapted and re-used in order to get over the initial hurdle of building stream processing applications.

Documentation

Index

Constants

View Source
const (
	// ErrorHandlingFailProcessor instructs laminar to fully fail the processor
	// when the error is encountered
	ErrorHandlingFailProcessor = iota

	// ErrorHandlingContinue ignores the error from goka's perspective
	ErrorHandlingContinue

	// ErrorHandlingDeleteValue deletes the value which caused the error using
	// goka.Context.Delete()
	ErrorHandlingDeleteValue
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CodecAfterEncodeFunc

type CodecAfterEncodeFunc func(ctx context.Context, data []byte) ([]byte, error)

CodecAfterEncodeFunc is called after the Encode function of a codec to modify the raw message

type CodecBeforeDecodeFunc

type CodecBeforeDecodeFunc func(ctx context.Context) ([]byte, context.Context,
	error)

CodecBeforeDecodeFunc is called before the Decode function of a codec to enrich the context.Context or modify the raw message

type MiddlewareContext

type MiddlewareContext interface {
	goka.Context
	RawMessage() []byte
}

MiddlewareContext extends a goka.Context with elements useful for crafting middlewares

type MiddlewareEnablingCodec

type MiddlewareEnablingCodec interface {
	DecodeEx(ctx context.Context, rawMessage []byte) (interface{}, error)
	EncodeEx(ctx context.Context, msg interface{}) ([]byte, error)
}

MiddlewareEnablingCodec expounds a Goka codec with additional processing contextual information

type ProcessingAfterFunc

type ProcessingAfterFunc func(ctx MiddlewareContext, fromLog,
	toLog interface{}) (interface{}, error)

ProcessingAfterFunc may be used to modify the value returned from a ProcessingCallback.

type ProcessingBeforeFunc

type ProcessingBeforeFunc func(ctx MiddlewareContext, msg interface{}) (
	context.Context, error)

ProcessingBeforeFunc is called before a ProcessingCallback and can enrich the process's context

type ProcessingErrorHandler

type ProcessingErrorHandler func(ctx MiddlewareContext, err error) uint

ProcessingErrorHandler is notified when a processing error is encountered and may return ErrorHandling* options to instruct laminar of how to handle the error

type ProcessingFinalizer

type ProcessingFinalizer func(ctx MiddlewareContext, err error, msg interface{})

ProcessingFinalizer will always be called after all other functions after processing a single message

type ProcessingHandler

type ProcessingHandler interface {
	ProcessCallback() goka.ProcessCallback
}

ProcessingHandler assembles Processing* functions together to be presented to goka

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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