rpc

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package rpc provides the interface to invoke UDFs (map, mapstream and reduce). structs in this package implements the Applier interface defined in pkg/forward/applier and pkg/reduce/applier. Which will be used by the map and reduce forwarders to invoke the UDFs and return the results. In case of errors if converts grpc errors to udf errors defined in pkg/udf/rpc/errors.go and sends them back to the forwarders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyUDFErr

type ApplyUDFErr struct {
	UserUDFErr bool
	Message    string
	InternalErr
}

ApplyUDFErr represents any mapUDF related error

func (ApplyUDFErr) Error

func (e ApplyUDFErr) Error() string

func (ApplyUDFErr) Is added in v1.1.6

func (e ApplyUDFErr) Is(target error) bool

Is checks if the error is of the same type

func (ApplyUDFErr) IsInternalErr

func (e ApplyUDFErr) IsInternalErr() bool

IsInternalErr is true if this is a platform issue. This is a blocking error.

func (ApplyUDFErr) IsUserUDFErr

func (e ApplyUDFErr) IsUserUDFErr() bool

IsUserUDFErr is true if the problem is due to the user code in the UDF.

type GRPCBasedMap

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

GRPCBasedMap is a map applier that uses gRPC client to invoke the map UDF. It implements the applier.MapApplier interface.

func NewUDSgRPCBasedMap

func NewUDSgRPCBasedMap(client mapper.Client) *GRPCBasedMap

func (*GRPCBasedMap) ApplyMap

func (u *GRPCBasedMap) ApplyMap(ctx context.Context, readMessage *isb.ReadMessage) ([]*isb.WriteMessage, error)

func (*GRPCBasedMap) CloseConn

func (u *GRPCBasedMap) CloseConn(ctx context.Context) error

CloseConn closes the gRPC client connection.

func (*GRPCBasedMap) IsHealthy

func (u *GRPCBasedMap) IsHealthy(ctx context.Context) error

IsHealthy checks if the map udf is healthy.

func (*GRPCBasedMap) WaitUntilReady

func (u *GRPCBasedMap) WaitUntilReady(ctx context.Context) error

WaitUntilReady waits until the map udf is connected.

type GRPCBasedMapStream

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

GRPCBasedMapStream is a map stream applier that uses gRPC client to invoke the map stream UDF. It implements the applier.MapStreamApplier interface.

func NewUDSgRPCBasedMapStream

func NewUDSgRPCBasedMapStream(client mapstreamer.Client) *GRPCBasedMapStream

func (*GRPCBasedMapStream) ApplyMapStream

func (u *GRPCBasedMapStream) ApplyMapStream(ctx context.Context, message *isb.ReadMessage, writeMessageCh chan<- isb.WriteMessage) error

func (*GRPCBasedMapStream) CloseConn

func (u *GRPCBasedMapStream) CloseConn(ctx context.Context) error

CloseConn closes the gRPC client connection.

func (*GRPCBasedMapStream) IsHealthy

func (u *GRPCBasedMapStream) IsHealthy(ctx context.Context) error

IsHealthy checks if the map stream udf is healthy.

func (*GRPCBasedMapStream) WaitUntilReady

func (u *GRPCBasedMapStream) WaitUntilReady(ctx context.Context) error

WaitUntilReady waits until the map stream udf is connected.

type GRPCBasedReduce

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

GRPCBasedReduce is a reduce applier that uses gRPC client to invoke the reduce UDF. It implements the applier.ReduceApplier interface.

func NewUDSgRPCBasedReduce

func NewUDSgRPCBasedReduce(client reducer.Client, vertexName string, vertexReplica int32) *GRPCBasedReduce

func (*GRPCBasedReduce) ApplyReduce

func (u *GRPCBasedReduce) ApplyReduce(ctx context.Context, partitionID *partition.ID, messageStream <-chan *isb.ReadMessage) ([]*isb.WriteMessage, error)

ApplyReduce accepts a channel of isbMessages and returns the aggregated result

func (*GRPCBasedReduce) CloseConn

func (u *GRPCBasedReduce) CloseConn(ctx context.Context) error

CloseConn closes the gRPC client connection.

func (*GRPCBasedReduce) IsHealthy

func (u *GRPCBasedReduce) IsHealthy(ctx context.Context) error

IsHealthy checks if the map udf is healthy.

func (*GRPCBasedReduce) WaitUntilReady

func (u *GRPCBasedReduce) WaitUntilReady(ctx context.Context) error

WaitUntilReady waits until the map udf is connected.

type InternalErr

type InternalErr struct {
	Flag        bool
	MainCarDown bool
}

InternalErr represents errors internal to the platform

Jump to

Keyboard shortcuts

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