function

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Protocol = "unix"
	Addr     = "/var/run/numaflow/function.sock"
	DatumKey = "x-numaflow-datum-key"
)

Variables

View Source
var (
	DROP = fmt.Sprintf("%U__DROP__", '\\') // U+005C__DROP__
	ALL  = fmt.Sprintf("%U__ALL__", '\\')  // U+005C__ALL__
)

Functions

This section is empty.

Types

type Client

type Client interface {
	CloseConn(ctx context.Context) error
	IsReady(ctx context.Context, in *emptypb.Empty) (bool, error)
	MapFn(ctx context.Context, datum *functionpb.Datum) ([]*functionpb.Datum, error)
	ReduceFn(ctx context.Context, datumStreamCh <-chan *functionpb.Datum) ([]*functionpb.Datum, error)
}

Client contains methods to call a gRPC client.

type IntervalWindow

type IntervalWindow interface {
	StartTime() time.Time
	EndTime() time.Time
}

IntervalWindow contains methods to get the information for a given interval window.

type MapFunc

type MapFunc func(ctx context.Context, key string, datum datum.Datum) Messages

MapFunc is utility type used to convert a HandleDo function to a MapHandler.

func (MapFunc) HandleDo

func (mf MapFunc) HandleDo(ctx context.Context, key string, datum datum.Datum) Messages

HandleDo implements the function of map function.

type MapHandler

type MapHandler interface {
	// HandleDo is the function to process each coming message
	HandleDo(ctx context.Context, key string, datum datum.Datum) Messages
}

MapHandler is the interface of map function implementation.

type Message

type Message struct {
	Key   string
	Value []byte
}

Message is used to wrap the data return by UDF functions

func MessageTo

func MessageTo(to string, value []byte) Message

MessageTo creates a Message that will forward to specified "to"

func MessageToAll

func MessageToAll(value []byte) Message

MessageToAll creates a Message that will forward to all

func MessageToDrop

func MessageToDrop() Message

MessageToDrop creates a Message to be dropped

type Messages

type Messages []Message

func MessagesBuilder

func MessagesBuilder() Messages

MessagesBuilder returns an empty instance of Messages

func (Messages) Append

func (m Messages) Append(msg Message) Messages

Append appends a Message

func (Messages) Items

func (m Messages) Items() []Message

Items returns the message list

type Metadata

type Metadata interface {
	IntervalWindow() IntervalWindow
}

Metadata contains methods to get the metadata for the reduce operation.

type ReduceFunc

type ReduceFunc func(ctx context.Context, key string, reduceCh <-chan datum.Datum, md Metadata) Messages

ReduceFunc is utility type used to convert a HandleDo function to a ReduceHandler.

func (ReduceFunc) HandleDo

func (rf ReduceFunc) HandleDo(ctx context.Context, key string, reduceCh <-chan datum.Datum, md Metadata) Messages

HandleDo implements the function of reduce function.

type ReduceHandler

type ReduceHandler interface {
	HandleDo(ctx context.Context, key string, reduceCh <-chan datum.Datum, md Metadata) Messages
}

ReduceHandler is the interface of reduce function implementation.

type Service

Service implements the proto gen server interface and contains the map operation handler and the reduce operation handler.

func (*Service) IsReady

IsReady returns true to indicate the gRPC connection is ready.

func (*Service) MapFn

MapFn applies a function to each datum element

func (*Service) ReduceFn

ReduceFn applies a reduce function to a datum stream.

Directories

Path Synopsis
example
sum

Jump to

Keyboard shortcuts

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