Documentation ¶
Overview ¶
Package sink implements the server code for User Defined Sink in golang.
Example:
package main import ( "context" "fmt" sinksdk "github.com/numaproj/numaflow-go/pkg/sink" "github.com/numaproj/numaflow-go/pkg/sink/server" ) func handle(ctx context.Context, datumStreamCh <-chan sinksdk.Datum) sinksdk.Responses { result := sinksdk.ResponsesBuilder() for datum := range datumStreamCh { fmt.Println(string(datum.Value())) result = result.Append(sinksdk.ResponseOK(datum.ID())) } return result } func main() { server.New().RegisterSinker(sinksdk.SinkFunc(handle)).Start(context.Background()) }
Index ¶
Constants ¶
View Source
const ( Protocol = "unix" Addr = "/var/run/numaflow/udsink.sock" // DefaultMaxMessageSize overrides gRPC max message size configuration // https://github.com/grpc/grpc-go/blob/master/server.go#L58-L59 // - defaultServerMaxReceiveMessageSize // - defaultServerMaxSendMessageSize DefaultMaxMessageSize = 1024 * 1024 * 4 )
Variables ¶
This section is empty.
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) SinkFn(ctx context.Context, datumList []*sinkpb.DatumRequest) ([]*sinkpb.Response, error) }
Client contains methods to call a gRPC client.
type Response ¶
type Response struct { // ID corresponds the ID in the message. ID string `json:"id"` // Successful or not. If it's false, "err" is expected to be present. Success bool `json:"success"` // Err represents the error message when "success" is false. Err string `json:"err,omitempty"` }
Response is the processing result of each message
func ResponseFailure ¶
func ResponseOK ¶
type Responses ¶
type Responses []Response
func ResponsesBuilder ¶
func ResponsesBuilder() Responses
ResponsesBuilder returns an empty instance of Responses
type Service ¶
type Service struct { sinkpb.UnimplementedUserDefinedSinkServer Sinker SinkHandler }
Service implements the proto gen server interface and contains the sink operation handler.
Click to show internal directories.
Click to hide internal directories.