models

package
v1.9.21 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

models describes the data types that will be used when storing export data in Mongo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUUID

func GetUUID(id string) (string, error)

GetUUID validates that the provided ID is a valid UUID, and returns it in the standard format. If no ID is provided, it generates a new UUID.

func ToContractId

func ToContractId(id primitive.ObjectID, uuid string) string

Types

type StoredObject

type StoredObject struct {
	// ObjectID uniquely identifies this object in Mongo
	ObjectID primitive.ObjectID `bson:"_id"`

	// UUID uniquely identifies this StoredObject
	UUID string `bson:"uuid"`

	// AppServiceKey identifies the app to which this data belongs.
	AppServiceKey string `bson:"appServiceKey"`

	// Payload is the data to be exported
	Payload []byte `bson:"payload"`

	// RetryCount is how many times this has tried to be exported
	RetryCount int `bson:"retryCount"`

	// PipelinePosition is where to pickup in the pipeline
	PipelinePosition int `bson:"pipelinePosition"`

	// Version is a hash of the functions to know if the pipeline has changed.
	Version string `bson:"version"`

	// CorrelationID is an identifier provided by EdgeX to track this record as it moves
	CorrelationID string `bson:"correlationID"`

	// EventID is used to identify an EdgeX event from the core services and mark it as pushed.
	EventID string `bson:"eventID"`

	// EventChecksum is used to identify CBOR encoded data from the core services and mark it as pushed.
	EventChecksum string `bson:"eventChecksum"`
}

StoredObject is the atomic and most abstract description of what is collected by the export store system.

func (*StoredObject) FromContract

func (o *StoredObject) FromContract(c contracts.StoredObject) error

FromContract builds a model object out of the supplied contract.

func (StoredObject) ToContract

func (o StoredObject) ToContract() contracts.StoredObject

ToContract builds a contract out of the supplied model.

Jump to

Keyboard shortcuts

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