info

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 12

Documentation

Overview

Package info is used for the gRPC server to provide the information such as protocol, sdk version, language, etc, to the client.

The server information can be used by the client to determine:

  • what is the right protocol to use (UDS or TCP)
  • what is the numaflow sdk version used by the server
  • what is language used by the server

The gRPC server (UDF, UDSink, etc.) is supposed to have a shared file system with the client (numa container).

Write() The gPRC server must use this function to write the correct ServerInfo when it starts.

Read() The client is supposed to call the function to read the server information, before it starts to communicate with the gRPC server.

WaitUntilReady() This function checks if the server info file is ready to read. The client (numa container) is supposed to call the function before it starts to Read() the server info file.

Index

Constants

View Source
const MapModeKey = "MAP_MODE"

MapModeKey is the key used in the server info metadata map to indicate which map mode is enabled.

Variables

View Source
var END = fmt.Sprintf("%U__END__", '\\') // U+005C__END__
View Source
var MinimumNumaflowVersion = map[ContainerType]string{
	Sourcer:           "1.4.0-z",
	Sourcetransformer: "1.4.0-z",
	Sinker:            "1.4.0-z",
	Mapper:            "1.4.0-z",
	Reducestreamer:    "1.4.0-z",
	Reducer:           "1.4.0-z",
	Sessionreducer:    "1.4.0-z",
	Sideinput:         "1.4.0-z",
	Fbsinker:          "1.4.0-z",
}

MinimumNumaflowVersion is the minimum version of Numaflow required by the current SDK version To update this value, please follow the instructions for MINIMUM_NUMAFLOW_VERSION in https://github.com/numaproj/numaflow-rs/blob/main/src/shared.rs

Functions

func WaitUntilReady

func WaitUntilReady(ctx context.Context, opts ...Option) error

WaitUntilReady waits until the server info is ready

func Write

func Write(svrInfo *ServerInfo, opts ...Option) error

Write writes the server info to a file

Types

type ContainerType added in v0.9.0

type ContainerType string
const (
	Sourcer           ContainerType = "sourcer"
	Sourcetransformer ContainerType = "sourcetransformer"
	Sinker            ContainerType = "sinker"
	Mapper            ContainerType = "mapper"
	Reducer           ContainerType = "reducer"
	Reducestreamer    ContainerType = "reducestreamer"
	Sessionreducer    ContainerType = "sessionreducer"
	Sideinput         ContainerType = "sideinput"
	Fbsinker          ContainerType = "fb-sinker"
)

the string content matches the corresponding server info file name. DO NOT change it unless the server info file name is changed.

type Language

type Language string
const (
	Go Language = "go"
)

type MapMode added in v0.8.0

type MapMode string
const (
	UnaryMap  MapMode = "unary-map"
	StreamMap MapMode = "stream-map"
	BatchMap  MapMode = "batch-map"
)

type Option

type Option func(*options)

func WithServerInfoFilePath

func WithServerInfoFilePath(f string) Option

WithServerInfoFilePath sets the server info file path

type Protocol

type Protocol string
const (
	UDS Protocol = "uds"
	TCP Protocol = "tcp"
)

type ServerInfo

type ServerInfo struct {
	Protocol               Protocol          `json:"protocol"`
	Language               Language          `json:"language"`
	MinimumNumaflowVersion string            `json:"minimum_numaflow_version"`
	Version                string            `json:"version"`
	Metadata               map[string]string `json:"metadata"`
}

ServerInfo is the information about the server

func GetDefaultServerInfo added in v0.8.0

func GetDefaultServerInfo() *ServerInfo

GetDefaultServerInfo returns a ServerInfo object with the default fields populated for Go-SDK

func Read

func Read(opts ...Option) (*ServerInfo, error)

Read reads the server info from a file

Jump to

Keyboard shortcuts

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