model

package
v0.1.0-M4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0, EPL-2.0 Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefinitionID

type DefinitionID interface {
	GetNamespace() string
	GetName() string
	GetVersion() string
	String() string
}

DefinitionID represents Ditto's Definition that follows the syntax <namespace>:<name>:<version>

type Feature

type Feature interface {
	GetID() string
	// Get the definition
	GetDefinition() []DefinitionID
	// Set the definition
	SetDefinition(definition []DefinitionID)
	// Remove the definition
	RemoveDefinition()

	// Get all properties
	GetProperties() map[string]interface{}
	// Get a specific property
	GetProperty(id string) interface{}
	// Update the properties
	SetProperties(properties map[string]interface{})
	// Update a single property
	SetProperty(id string, value interface{})
	// Remove all properties
	RemoveProperties()
	// Remove a single property
	RemoveProperty(id string)
}

Feature represents Ditto's Feature model and all its properties

type NamespacedID

type NamespacedID interface {
	GetNamespace() string
	GetName() string
	String() string
}

NamespacedID represents Ditto's Namespaced ID that follows the syntax <namespace>:<name>

type Registry

type Registry interface {
	// Create a thing with the provided id and namespace
	Create(id NamespacedID, thing Thing) error
	// Get a thing with the provided id and namespace
	Get(id NamespacedID) Thing
	// Modify a thing with the provided id and namespace
	Update(id NamespacedID) error
	// Remove a thing with the provided id and namespace
	Remove(id NamespacedID) error
}

Registry is the things management entry point

type Thing

type Thing interface {
	// Get the thing's namespace
	GetNamespace() string
	// GetID the thing's id
	GetID() NamespacedID

	// Retrieves the thing's policy id
	GetPolicy() NamespacedID

	// Get the thing's definition
	GetDefinition() DefinitionID
	// Updatest he thing;s definition
	SetDefinition(DefinitionID DefinitionID) error
	// Deletes the thing's definition
	RemoveDefinition() error

	// Retrieve the thing's attributes
	GetAttributes() map[string]interface{}
	// Retrieve a thing's attribute
	GetAttribute(id string) interface{}
	// Updates the thing's attributes
	SetAttributes(attributes map[string]interface{}) error
	// Updates a thing's attribute
	SetAttribute(id string, value interface{}) error
	// Delete the thing's attributes
	RemoveAttributes() error
	// Delete a thing's attribute
	RemoveAttribute(id string) error

	// Retrieve the thing's features
	GetFeatures() map[string]Feature
	// Retrieve a thing's features
	GetFeature(id string) Feature
	// Update the thing's features
	SetFeatures(features map[string]Feature) error
	// Update a thing's feature
	SetFeature(id string, feature Feature) error
	// Remove the thing's features
	RemoveFeatures() error
	// Remove a thing's feature
	RemoveFeature(id string) error

	// Set the definition
	SetFeatureDefinition(featureID string, DefinitionID []DefinitionID) error
	// Remove the definition
	RemoveFeatureDefinition(featureID string) error
	// Update the properties
	SetFeatureProperties(featureID string, properties map[string]interface{}) error
	// Update a single property
	SetFeatureProperty(featureID string, propertyID string, value interface{}) error
	// Remove all properties
	RemoveFeatureProperties(featureID string) error
	// Remove a single property
	RemoveFeatureProperty(featureID string, propertyID string) error

	// SendMessage initiates the sending of a live outbox message from the Thing
	SendMessage(action string, value interface{}) error

	// SendFeatureMessage initiates the sending of a live outbox message from the provided feature of the Thing
	SendFeatureMessage(featureID string, action string, value interface{}) error

	// Get the thing's revision
	GetRevision() int64

	// Get the thing's last modification's timestamp
	GetLastModified() string
}

Thing represents Ditto's Thing model

Jump to

Keyboard shortcuts

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