evmodel

package
v0.0.0-...-81c02da Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package evmodel have the struct models and DB functionalities

Index

Constants

View Source
const (
	// EventFormatType is set to Event (MetricReport is not supporting now
	EventFormatType = "Event"

	// SubscriptionType is set to RedfishEvent (make it as array of SubscriptionType
	SubscriptionType = "RedfishEvent"

	// Context is set to default if its empty
	Context = "Default"

	// SubscriptionName is set to default name incase if its empty
	SubscriptionName = "Event Subscription"

	// SubscriptionIndex is a index name which required for indexing of event subscriptions
	SubscriptionIndex = common.SubscriptionIndex

	// DeviceSubscriptionIndex is a index name which required for indexing
	// subscription of device
	DeviceSubscriptionIndex = common.DeviceSubscriptionIndex

	// UndeliveredEvents holds table for UndeliveredEvent
	UndeliveredEvents = "UndeliveredEvents"

	// ReadInProgress holds table for ReadInProgress
	ReadInProgress = "ReadInProgress"
	// DeliveryRetryPolicy is set to default value incase if its empty
	DeliveryRetryPolicy = "RetryForever"

	// AggregateSubscriptionIndex is a index name which required for indexing
	// subscription of device
	AggregateSubscriptionIndex = common.AggregateSubscriptionIndex
)

Variables

View Source
var (
	//GetDbConnection alias for common.GetDBConnection
	GetDbConnection = common.GetDBConnection
)

Functions

func DeleteDeviceSubscription

func DeleteDeviceSubscription(hostIP string) error

DeleteDeviceSubscription is to delete subscription details of device

func DeleteEvtSubscription

func DeleteEvtSubscription(key string) error

DeleteEvtSubscription is to delete event subscription details

func DeleteUndeliveredEvents

func DeleteUndeliveredEvents(destination string) error

DeleteUndeliveredEvents deletes the undelivered events for the destination

func DeleteUndeliveredEventsFlag

func DeleteUndeliveredEventsFlag(destination string) error

DeleteUndeliveredEventsFlag deletes the PickUpUndeliveredEventsFlag key from the DB, return error if any

func GetAggregateHosts

func GetAggregateHosts(aggregateID string) ([]string, error)

GetAggregateHosts is to get subscription details of device

func GetAggregateList

func GetAggregateList(hostIP string) ([]string, error)

GetAggregateList will fetch aggregate list

func GetAllAggregates

func GetAllAggregates() ([]string, error)

GetAllAggregates return all aggregate url added in DB

func GetAllDeviceSubscriptions

func GetAllDeviceSubscriptions() ([]string, error)

GetAllDeviceSubscriptions is to get subscription details of device

func GetAllEvtSubscriptions

func GetAllEvtSubscriptions() ([]string, error)

GetAllEvtSubscriptions is to get all event subscription details

func GetAllFabrics

func GetAllFabrics() ([]string, error)

GetAllFabrics return all Fabrics

func GetAllKeysFromTable

func GetAllKeysFromTable(table string) ([]string, error)

GetAllKeysFromTable return all matching data give table name

func GetAllMatchingDetails

func GetAllMatchingDetails(table, pattern string, dbtype common.DbType) ([]string, *errors.Error)

GetAllMatchingDetails accepts the table name ,pattern and DB type and return all the keys which matches the pattern

func GetAllPlugins

func GetAllPlugins() ([]common.Plugin, *errors.Error)

GetAllPlugins gets all the Plugin from the db

func GetAllSystems

func GetAllSystems() ([]string, error)

GetAllSystems retrieves all the compute systems in odimra

func GetDeviceSubscriptions

func GetDeviceSubscriptions(hostIP string) (*common.DeviceSubscription, error)

GetDeviceSubscriptions is to get subscription details of device

func GetPluginData

func GetPluginData(pluginID string) (*common.Plugin, *errors.Error)

GetPluginData will fetch plugin details

func GetResource

func GetResource(Table, key string) (string, *errors.Error)

GetResource fetches a resource from database using table and key

func GetSingleSystem

func GetSingleSystem(id string) (string, error)

GetSingleSystem retrieves specific compute system in odimra based on the ID

func GetSliceFromString

func GetSliceFromString(sliceString string) []string

GetSliceFromString is to convert the string to array

func GetTarget

func GetTarget(deviceUUID string) (*common.Target, error)

GetTarget fetches the System(Target Device Credentials) table details

func GetUndeliveredEvents

func GetUndeliveredEvents(destination string) (string, error)

GetUndeliveredEvents read the undelivered events for the destination

func GetUndeliveredEventsFlag

func GetUndeliveredEventsFlag(destination string) (bool, error)

GetUndeliveredEventsFlag will get the flag to maintain one instance already picked up the undelivered events for the destination

func GetUndeliveredEventsKeyList

func GetUndeliveredEventsKeyList(table, pattern string, dbType common.DbType, nextCursor int) ([]string, int, *errors.Error)

GetUndeliveredEventsKeyList accepts the table name ,pattern ,cursor value and DB type and return all the keys which matches the pattern

func SaveAggregateSubscription

func SaveAggregateSubscription(aggregateID string, hostIP []string) error

SaveAggregateSubscription is to save subscription details of device

func SaveDeviceSubscription

func SaveDeviceSubscription(devSubscription common.DeviceSubscription) error

SaveDeviceSubscription is to save subscription details of device

func SaveEventSubscription

func SaveEventSubscription(evtSubscription SubscriptionResource) error

SaveEventSubscription is to save event subscription details in db

func SaveUndeliveredEvents

func SaveUndeliveredEvents(key string, event []byte) error

SaveUndeliveredEvents accepts the undelivered event and destination with unique eventId and saves it

func SetUndeliveredEventsFlag

func SetUndeliveredEventsFlag(destination string) error

SetUndeliveredEventsFlag will set the flag to maintain one instance already picked up the undelivered events for the destination

func UpdateAggregateHosts

func UpdateAggregateHosts(aggregateID string, hostIP []string) error

UpdateAggregateHosts is to update aggregate hosts details of device

func UpdateDeviceSubscriptionLocation

func UpdateDeviceSubscriptionLocation(devSubscription common.DeviceSubscription) error

UpdateDeviceSubscriptionLocation is to update subscription details of device

func UpdateEventSubscription

func UpdateEventSubscription(evtSubscription SubscriptionResource) error

UpdateEventSubscription is to update event subscription details

Types

type Aggregate

type Aggregate struct {
	Elements []dmtf.Link `json:"Elements"`
}

Aggregate is the model for Aggregate information

func GetAggregate

func GetAggregate(aggregateURI string) (Aggregate, *errors.Error)

GetAggregate fetches the aggregate info for the given aggregateURI

func GetAggregateData

func GetAggregateData(aggregateKey string) (Aggregate, error)

GetAggregateData will fetch aggregate details

type EventPost

type EventPost struct {
	Destination        string
	EventID            string
	UndeliveredEventID string
	Message            []byte
}

EventPost is the model for post data to client

type Fabric

type Fabric struct {
	FabricUUID string
	PluginID   string
}

Fabric is the model for fabrics information

func GetFabricData

func GetFabricData(fabricID string) (Fabric, error)

GetFabricData will fetch fabric details

type PluginTaskInfo

type PluginTaskInfo struct {
	Location         string
	PluginIP         string
	PluginServerName string
}

PluginTaskInfo hold the task information from plugin

type SubscriptionResource

type SubscriptionResource struct {
	EventDestination *dmtf.EventDestination `json:"EventDestination"`
	EventHostIP      string                 `json:"EventHostIP,omitempty"`
	Hosts            []string               `json:"Hosts"`
	SubscriptionID   string                 `json:"SubscriptionID"`
	UserName         string                 `json:"UserName"`
	Location         string                 `json:"location,omitempty"`
}

SubscriptionResource is a model to store the subscription details

func GetEvtSubscriptions

func GetEvtSubscriptions(searchKey string) ([]SubscriptionResource, error)

GetEvtSubscriptions is to get event subscription details

Jump to

Keyboard shortcuts

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