Documentation
¶
Overview ¶
Package mapper implements the server code for Map Operation.
Examples: https://github.com/numaproj/numaflow-go/tree/main/examples/mapper
Index ¶
- Variables
- func NewServer(m Mapper, inputOptions ...Option) numaflow.Server
- type Datum
- type Mapper
- type MapperFunc
- type Message
- func (m Message) Keys() []string
- func (m Message) NackOptions() *NackOptions
- func (m Message) Tags() []string
- func (m Message) UserMetadata() *UserMetadata
- func (m Message) Value() []byte
- func (m Message) WithKeys(keys []string) Message
- func (m Message) WithTags(tags []string) Message
- func (m Message) WithUserMetadata(userMetadata *UserMetadata) Message
- type Messages
- type NackOptions
- type Option
- type Service
- type SystemMetadata
- type UserMetadata
Constants ¶
This section is empty.
Variables ¶
var ( DROP = fmt.Sprintf("%U__DROP__", '\\') // U+005C__DROP__ NACK = fmt.Sprintf("%U__NACK__", '\\') // U+005C__NACK__ )
var NewSystemMetadata = metadata.NewSystemMetadata
NewSystemMetadata creates a new SystemMetadata. This is for internal and testing purposes only.
var NewUserMetadata = metadata.NewUserMetadata
NewUserMetadata creates a new UserMetadata.
Functions ¶
Types ¶
type Datum ¶
type Datum interface {
// Value returns the payload of the message.
Value() []byte
// EventTime returns the event time of the message.
EventTime() time.Time
// Watermark returns the watermark of the message.
Watermark() time.Time
// Headers returns the headers of the message.
Headers() map[string]string
// UserMetadata returns the user metadata of the message.
UserMetadata() *UserMetadata
// SystemMetadata returns the system metadata of the message.
SystemMetadata() *SystemMetadata
}
Datum contains methods to get the payload information.
func NewHandlerDatum ¶
func NewHandlerDatum(value []byte, eventTime time.Time, watermark time.Time, headers map[string]string, userMetadata *UserMetadata, systemMetadata *SystemMetadata) Datum
type Mapper ¶
type Mapper interface {
// Map is the function to process each coming message.
Map(ctx context.Context, keys []string, datum Datum) Messages
}
Mapper is the interface of map function implementation.
type MapperFunc ¶
MapperFunc is a utility type used to convert a map function to a Mapper.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is used to wrap the data return by Map functions
func MessageToNack ¶ added in v0.12.0
func MessageToNack(opts *NackOptions) Message
MessageToNack creates a Message that negatively acknowledges the input message, requesting redelivery. opts may be nil; when set it carries redelivery options.
func (Message) NackOptions ¶ added in v0.12.0
func (m Message) NackOptions() *NackOptions
NackOptions returns the message's nack options (nil if not a nack message).
func (Message) UserMetadata ¶ added in v0.11.0
func (m Message) UserMetadata() *UserMetadata
UserMetadata returns message user metadata
func (Message) WithTags ¶
WithTags is used to assign the tags to the message tags will be used for conditional forwarding
func (Message) WithUserMetadata ¶ added in v0.11.0
func (m Message) WithUserMetadata(userMetadata *UserMetadata) Message
WithUserMetadata is used to assign the user metadata to the message
type Messages ¶
type Messages []Message
func MessagesBuilder ¶
func MessagesBuilder() Messages
MessagesBuilder returns an empty instance of Messages
type NackOptions ¶ added in v0.12.0
type NackOptions = nackoptions.NackOptions
NackOptions carries per-message redelivery options for a nacked message. See MessageToNack.
type Option ¶
type Option func(*options)
Option is the interface to apply options.
func WithMaxMessageSize ¶
WithMaxMessageSize sets the server max receive message size and the server max send message size to the given size.
func WithServerInfoFilePath ¶
WithServerInfoFilePath sets the server info file path to the given path.
func WithSockAddr ¶
WithSockAddr start the server with the given sock addr. This is mainly used for testing purposes.
type Service ¶
type Service struct {
mappb.UnimplementedMapServer
Mapper Mapper
// contains filtered or unexported fields
}
Service implements the proto gen server interface and contains the map operation handler.
type SystemMetadata ¶ added in v0.11.0
type SystemMetadata = metadata.SystemMetadata
SystemMetadata wraps system-generated metadata groups per message. It is read-only to UDFs.
type UserMetadata ¶ added in v0.11.0
type UserMetadata = metadata.UserMetadata
UserMetadata wraps user-defined metadata groups per message.