ordermanagement

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Types and functions to be used by services that manage orders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChildOrders

func GetChildOrders(ctx context.Context, id string, kafkaReaderConfig kafka.ReaderConfig, bufferSize int) (<-chan ChildOrder, error)

GetChildOrders returns a channel of orders whose originator id matches the given order id and are thus children of the order.

func NewChildOrderUpdatesDistributor

func NewChildOrderUpdatesDistributor(updates <-chan ChildOrder, initialSubscriptionsBufferSize int) *childOrderUpdatesDistributor

Types

type ChildOrder

type ChildOrder struct {
	ParentOrderId string
	Child         *model.Order
}

type OrderCache

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

OrderCache is an in memory cache of the latest order state for a given owner backed by a persistent store.

func NewOwnerOrderCache added in v1.4.0

func NewOwnerOrderCache(ctx context.Context, ownerId string, store orderStore) (*OrderCache, error)

func (*OrderCache) Close

func (oc *OrderCache) Close()

func (*OrderCache) GetOrder

func (oc *OrderCache) GetOrder(orderId string) (*model.Order, bool, error)

GetOrder returns the order and true if found, otherwise a nil value and false

func (*OrderCache) Store

func (oc *OrderCache) Store(ctx context.Context, order *model.Order) error

type OrderStream added in v1.4.0

type OrderStream interface {
	Chan() <-chan *model.Order
	Close()
}

type ParentOrder

type ParentOrder struct {
	model.Order
	ChildOrders map[string]*model.Order
	// contains filtered or unexported fields
}

ParentOrder has a one-to-many relationship to its child orders. The parent order aggregates and summarises state across its children.

func NewParentOrder

func NewParentOrder(order model.Order) *ParentOrder

func (*ParentOrder) OnChildOrderUpdate

func (po *ParentOrder) OnChildOrderUpdate(childOrder *model.Order) error

Jump to

Keyboard shortcuts

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