handler

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDimensions added in v1.12.0

func ValidateDimensions(dimensions []*model.Dimension) error

func ValidateInstance added in v1.12.0

func ValidateInstance(instance *model.Instance) error

Types

type CompletedProducer

type CompletedProducer interface {
	Completed(ctx context.Context, e event.InstanceCompleted) error
}

CompletedProducer Producer kafka messages for instances that have been successfully processed.

type InstanceEventHandler

type InstanceEventHandler struct {
	Store             store.Storer
	DatasetAPICli     *client.DatasetAPI
	Producer          CompletedProducer
	BatchSize         int
	EnablePatchNodeID bool
}

InstanceEventHandler provides functions for handling DimensionsExtractedEvents.

func (*InstanceEventHandler) Handle

func (hdlr *InstanceEventHandler) Handle(ctx context.Context, newInstance event.NewInstance) error

Handle retrieves the dimensions for specified instanceID from the Import API, creates an MyInstance entity for provided instanceID, creates a Dimension entity for each dimension and a relationship to the MyInstance it belongs to and makes a PUT request to the Import API with the database ID of each Dimension entity.

func (*InstanceEventHandler) SetOrderAndNodeIDs added in v1.12.0

func (hdlr *InstanceEventHandler) SetOrderAndNodeIDs(ctx context.Context, instanceID string, dimensions []*model.Dimension) error

SetOrderAndNodeIDs obtains the codes order from the graph database and patches the existing dimension options in dataset API (updating node_id and order values) this method assumes that valid non-nil values are provided (have been created or validated by caller)

func (*InstanceEventHandler) Validate added in v1.12.0

func (hdlr *InstanceEventHandler) Validate(newInstance event.NewInstance) error

Jump to

Keyboard shortcuts

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