metadata

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package metadata provides shared metadata types for Numaflow SDK components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserMetadataToProto

func UserMetadataToProto(md *UserMetadata) *common.Metadata

UserMetadataToProto converts UserMetadata to the outgoing proto metadata. It always returns a non-nil *common.Metadata (with empty maps if md is nil).

Types

type SystemMetadata

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

SystemMetadata wraps system-generated metadata groups per message. It is read-only to UDFs.

func NewSystemMetadata

func NewSystemMetadata() *SystemMetadata

NewSystemMetadata creates a new SystemMetadata. This is for internal and testing purposes only.

func SystemMetadataFromProto

func SystemMetadataFromProto(proto *common.Metadata) *SystemMetadata

SystemMetadataFromProto converts the incoming proto metadata to SystemMetadata.

func (*SystemMetadata) Groups

func (md *SystemMetadata) Groups() []string

Groups returns the groups of the system metadata. If there are no groups, it returns an empty slice.

Usage example:

systemMetadata := datum.SystemMetadata()
groups := systemMetadata.Groups()

func (*SystemMetadata) Keys

func (md *SystemMetadata) Keys(group string) []string

Keys returns the keys of the system metadata for the given group. If the group is not present, it returns an empty slice.

Usage example:

systemMetadata := datum.SystemMetadata()
keys := systemMetadata.Keys("group-name")

func (*SystemMetadata) Value

func (md *SystemMetadata) Value(group, key string) []byte

Value returns the value of the system metadata for the given group and key. If the group or key is not present, it returns an empty slice.

Usage example:

systemMetadata := datum.SystemMetadata()
value := systemMetadata.Value("group-name", "key")

type UserMetadata

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

UserMetadata wraps user-defined metadata groups per message.

func NewUserMetadata

func NewUserMetadata() *UserMetadata

NewUserMetadata creates a new UserMetadata.

func UserMetadataFromProto

func UserMetadataFromProto(proto *common.Metadata) *UserMetadata

UserMetadataFromProto converts the incoming proto metadata to UserMetadata.

func (*UserMetadata) AddKV

func (md *UserMetadata) AddKV(group, key string, value []byte)

AddKV adds a key-value pair under the given group name to the user metadata. If the group is not present, it creates a new group. If the key is already present, it overwrites the value.

Usage example:

userMetadata := NewUserMetadata()
userMetadata.AddKV("group-name", "key", []byte("value"))

func (*UserMetadata) CreateGroup

func (md *UserMetadata) CreateGroup(group string)

CreateGroup creates a new group in the user metadata.

Usage example:

userMetadata := NewUserMetadata()
userMetadata.CreateGroup("group-name")

func (*UserMetadata) Groups

func (md *UserMetadata) Groups() []string

Groups returns the groups of the user metadata. If there are no groups, it returns an empty slice.

Usage example:

userMetadata := datum.UserMetadata()
groups := userMetadata.Groups()

func (*UserMetadata) Keys

func (md *UserMetadata) Keys(group string) []string

Keys returns the keys of the user metadata for the given group. If the group is not present, it returns an empty slice.

Usage example:

userMetadata := datum.UserMetadata()
keys := userMetadata.Keys("group-name")

func (*UserMetadata) RemoveGroup

func (md *UserMetadata) RemoveGroup(group string)

RemoveGroup removes a group from the user metadata. If the group is not present, it's a no-op.

Usage example:

userMetadata := datum.UserMetadata()
userMetadata.RemoveGroup("group-name")

func (*UserMetadata) RemoveKey

func (md *UserMetadata) RemoveKey(group, key string)

RemoveKey removes a key from a group in the user metadata. If the key or group is not present, it's a no-op.

Usage example:

userMetadata := datum.UserMetadata()
userMetadata.RemoveKey("group-name", "key")

func (*UserMetadata) Value

func (md *UserMetadata) Value(group, key string) []byte

Value returns the value of the user metadata for the given group and key. If the group or key is not present, it returns an empty slice.

Usage example:

userMetadata := datum.UserMetadata()
value := userMetadata.Value("group-name", "key")

Jump to

Keyboard shortcuts

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