Documentation
¶
Overview ¶
coredata provides clients used for integration with the core-data service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventClient ¶
type EventClient interface {
// Events gets a list of all events
Events(ctx context.Context) ([]models.Event, error)
// Event gets an event by its id
Event(ctx context.Context, id string) (models.Event, error)
// EventCount returns the total count of events
EventCount(ctx context.Context) (int, error)
// EventCountForDevice returns the total event count for the specified device
EventCountForDevice(ctx context.Context, deviceId string) (int, error)
// EventsForDevice returns events up to a specified number that were generated by a given device
EventsForDevice(ctx context.Context, deviceID string, limit int) ([]models.Event, error)
// EventsForInterval returns events generated within a specific time period
EventsForInterval(ctx context.Context, start int, end int, limit int) ([]models.Event, error)
// EventsForDeviceAndValueDescriptor returns events for the specified device and value descriptor
EventsForDeviceAndValueDescriptor(ctx context.Context, deviceId string, vd string, limit int) ([]models.Event, error)
// Add will post a new event
Add(ctx context.Context, event *models.Event) (string, error)
// AddBytes posts a new event using an array of bytes, supporting encoding of the event by the caller.
AddBytes(ctx context.Context, event []byte) (string, error)
// DeleteForDevice will delete events by the specified device name
DeleteForDevice(ctx context.Context, deviceID string) error
// DeleteOld deletes events according to their age
DeleteOld(ctx context.Context, age int) error
// Delete will delete an event by its id
Delete(ctx context.Context, id string) error
// MarkPushed designates an event as having been successfully exported
MarkPushed(ctx context.Context, id string) error
// MarkPushedByChecksum designates an event as having been successfully exported using a checksum for the respective event.
MarkPushedByChecksum(ctx context.Context, checksum string) error
// MarshalEvent will perform JSON or CBOR encoding of the supplied Event. If one or more Readings on the Event
// has a populated BinaryValue, the marshaling will be CBOR. Default is JSON.
MarshalEvent(e models.Event) ([]byte, error)
}
EventClient defines the interface for interactions with the Event endpoint on the EdgeX Foundry core-data service.
func NewEventClient ¶
func NewEventClient(urlClient interfaces.URLClient) EventClient
NewEventClient creates an instance of EventClient
type ReadingClient ¶
type ReadingClient interface {
// Readings returns a list of all readings
Readings(ctx context.Context) ([]models.Reading, error)
// ReadingCount returns a count of the total readings
ReadingCount(ctx context.Context) (int, error)
// Reading returns a reading by its id
Reading(ctx context.Context, id string) (models.Reading, error)
// ReadingsForDevice returns readings up to a specified limit for a given device
ReadingsForDevice(ctx context.Context, deviceId string, limit int) ([]models.Reading, error)
// ReadingsForNameAndDevice returns readings up to a specified limit for a given device and value descriptor name
ReadingsForNameAndDevice(ctx context.Context, name string, deviceId string, limit int) ([]models.Reading, error)
// ReadingsForName returns readings up to a specified limit for a given value descriptor name
ReadingsForName(ctx context.Context, name string, limit int) ([]models.Reading, error)
// ReadingsForUOMLabel returns readings up to a specified limit for a given UOM label
ReadingsForUOMLabel(ctx context.Context, uomLabel string, limit int) ([]models.Reading, error)
// ReadingsForLabel returns readings up to a specified limit for a given label
ReadingsForLabel(ctx context.Context, label string, limit int) ([]models.Reading, error)
// ReadingsForType returns readings up to a specified limit of a given type
ReadingsForType(ctx context.Context, readingType string, limit int) ([]models.Reading, error)
// ReadingsForInterval returns readings up to a specified limit generated within a specific time period
ReadingsForInterval(ctx context.Context, start int, end int, limit int) ([]models.Reading, error)
// Add a new reading
Add(ctx context.Context, reading *models.Reading) (string, error)
// Delete eliminates a reading by its id
Delete(ctx context.Context, id string) error
}
ReadingClient defines the interface for interactions with the Reading endpoint on core-data.
func NewReadingClient ¶
func NewReadingClient(urlClient interfaces.URLClient) ReadingClient
NewReadingClient creates an instance of a ReadingClient
type ValueDescriptorClient ¶
type ValueDescriptorClient interface {
// ValueDescriptors returns a list of all value descriptors
ValueDescriptors(ctx context.Context) ([]models.ValueDescriptor, error)
// ValueDescriptor returns the value descriptor for the specified id
ValueDescriptor(ctx context.Context, id string) (models.ValueDescriptor, error)
// ValueDescriptorForName returns the value descriptor for the specified name
ValueDescriptorForName(ctx context.Context, name string) (models.ValueDescriptor, error)
// ValueDescriptorsByLabel returns the value descriptors for the specified label
ValueDescriptorsByLabel(ctx context.Context, label string) ([]models.ValueDescriptor, error)
// ValueDescriptorsForDevice returns the value descriptors associated with readings from the specified device (by id)
ValueDescriptorsForDevice(ctx context.Context, deviceId string) ([]models.ValueDescriptor, error)
// ValueDescriptorsForDeviceByName returns the value descriptors associated with readings from the specified device (by name)
ValueDescriptorsForDeviceByName(ctx context.Context, deviceName string) ([]models.ValueDescriptor, error)
// ValueDescriptorsByUomLabel returns the value descriptors for the specified uomLabel
ValueDescriptorsByUomLabel(ctx context.Context, uomLabel string) ([]models.ValueDescriptor, error)
// ValueDescriptorsUsage return a map describing which ValueDescriptors are currently in use. The key is the
// ValueDescriptor name and the value is a bool specifying if the ValueDescriptor is in use.
ValueDescriptorsUsage(ctx context.Context, names []string) (map[string]bool, error)
// Adds the specified value descriptor
Add(ctx context.Context, vdr *models.ValueDescriptor) (string, error)
// Updates the specified value descriptor
Update(ctx context.Context, vdr *models.ValueDescriptor) error
// Delete eliminates a value descriptor (specified by id)
Delete(ctx context.Context, id string) error
// Delete eliminates a value descriptor (specified by name)
DeleteByName(ctx context.Context, name string) error
}
ValueDescriptorClient defines the interface for interactions with the Value Descriptor endpoint on core-data.
func NewValueDescriptorClient ¶
func NewValueDescriptorClient(urlClient interfaces.URLClient) ValueDescriptorClient
Click to show internal directories.
Click to hide internal directories.