stateful

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: GPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ContextTransaction = "ContextTransaction"
)

Variables

This section is empty.

Functions

func NewSingleReadWrite

func NewSingleReadWrite(configurations ...runtime.Configuration[*SingleStateReadWrite]) stateless.SingleFunction

constructor

func TopicMissingError

func TopicMissingError(topic string) error

func WithPersistenceIdSwitchPersistenceIdFunction

func WithPersistenceIdSwitchPersistenceIdFunction(topic string, f PersistenceIdFunction[[]byte, []byte]) runtime.Configuration[*PersistenceIdSwitch]

configuration

func WithSingleReadWriteStatefulFunction

func WithSingleReadWriteStatefulFunction(next SingleFunction) runtime.Configuration[*SingleStateReadWrite]

func WithSingleReadWriteTransactionPersistenceIdFunc

func WithSingleReadWriteTransactionPersistenceIdFunc(persistenceIdFunc func(context.Context, message.Message[message.Bytes, message.Bytes]) (string, error)) runtime.Configuration[*SingleStateReadWrite]

configuration

func WithSingleStatefulDeduplicateNextFunction

func WithSingleStatefulDeduplicateNextFunction(next SingleFunction) runtime.Configuration[*SingleStatefulDeduplicate]

configuration

func WithSingleTopicSwitchStatefulSingleFunction

func WithSingleTopicSwitchStatefulSingleFunction(topic string, f SingleFunction) runtime.Configuration[*SingleTopicSwitch]

configuration

Types

type OneToOneFunction

type OneToOneFunction[S any, IK any, IV any, OK any, OV any] func(context.Context, message.Message[IK, IV], SingleState[S]) (*message.Message[OK, OV], SingleState[S], error)

type OneToTwoFunction

type OneToTwoFunction[S any, IK any, IV any, OK1 any, OV1 any, OK2 any, OV2 any] func(context.Context, message.Message[IK, IV], SingleState[S]) (*message.Message[OK1, OV1], *message.Message[OK2, OV2], SingleState[S], error)

type PersistenceIdFunction

type PersistenceIdFunction[IK any, IV any] func(context.Context, message.Message[IK, IV]) (string, error)

func ConvertPersistenceId

func ConvertPersistenceId[IK any, IV any](
	source PersistenceIdFunction[IK, IV],
	ik format.Format[IK],
	iv format.Format[IV],
) PersistenceIdFunction[[]byte, []byte]

func NewSinglePersistenceIdSwitch

func NewSinglePersistenceIdSwitch(configurations ...runtime.Configuration[*PersistenceIdSwitch]) PersistenceIdFunction[[]byte, []byte]

constructor

type PersistenceIdSwitch

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

implementation

func (*PersistenceIdSwitch) Apply

type SingleFunction

func ConvertOneToOne

func ConvertOneToOne[S any, IK any, IV any, OK any, OV any](
	source OneToOneFunction[S, IK, IV, OK, OV],
	s format.Format[S],
	ik format.Format[IK],
	iv format.Format[IV],
	ok format.Format[OK],
	ov format.Format[OV],
) SingleFunction

func ConvertOneToTwo

func ConvertOneToTwo[S any, IK any, IV any, OK1 any, OV1 any, OK2 any, OV2 any](
	source OneToTwoFunction[S, IK, IV, OK1, OV1, OK2, OV2],
	s format.Format[S],
	ik format.Format[IK],
	iv format.Format[IV],
	ok1 format.Format[OK1],
	ov1 format.Format[OV1],
	ok2 format.Format[OK2],
	ov2 format.Format[OV2],
) SingleFunction

func NewSingleStatefulDeduplicate

func NewSingleStatefulDeduplicate(configurations ...runtime.Configuration[*SingleStatefulDeduplicate]) SingleFunction

constructor

func NewSingleTopicSwitch

func NewSingleTopicSwitch(configurations ...runtime.Configuration[*SingleTopicSwitch]) SingleFunction

constructor

type SingleState

type SingleState[S any] struct {
	PersistenceId      string
	Internal           *protobuf.State
	Results            *protobuf.Results
	Content            S
	CreatedTimestampMs int64
	UpdatedTimestampMs int64
}

func ConvertSingleState

func ConvertSingleState[V1 any, V2 any](
	source SingleState[V1],
	v1 format.Format[V1],
	v2 format.Format[V2],
) (SingleState[V2], error)

assuming byte compatibility, i.e. bytes <-> proto, string <-> json

func NewSingleState

func NewSingleState[S any](content S) SingleState[S]

func SetDefault

func SetDefault[S any](s SingleState[S]) SingleState[S]

type SingleStateReadWrite

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

implementation

type SingleStateRepository

type SingleStateRepository interface {
	Get(ctx context.Context, persistenceId string) (SingleState[message.Bytes], error)
	Upsert(ctx context.Context, persistenceId string, dbState SingleState[message.Bytes]) error
}

type SingleStatefulDeduplicate

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

implementation

type SingleTopicSwitch

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

implementation

Jump to

Keyboard shortcuts

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