historyapi

package
v0.0.0-...-147f0cf Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package history with message definitions for reading the history store.

Index

Constants

View Source
const (
	// CursorFirstMethod return the oldest value in the history
	CursorFirstMethod = "cursorFirst"
	// CursorLastMethod return the newest value in the history
	CursorLastMethod = "cursorLast"
	// CursorNextMethod returns the next value in the history
	CursorNextMethod = "cursorNext"
	// CursorPrevMethod returns the previous value in the history
	CursorPrevMethod = "cursorPrev"
)

cursor methods that take the key as arg and returns a value

View Source
const CursorNextNMethod = "cursorNextN"

CursorNextNMethod returns a batch of next N historical values

View Source
const CursorPrevNMethod = "cursorPrevN"

CursorPrevNMethod returns a batch of prior N historical values

View Source
const CursorReleaseMethod = "cursorRelease"

CursorReleaseMethod releases the cursor and resources This MUST be called after the cursor is not longer used.

View Source
const CursorSeekMethod = "cursorSeek"

CursorSeekMethod seeks the starting point in time for iterating the history This returns a single value response with the value at timestamp or next closest if it doesn't exist. Returns empty value when there are no values at or past the given timestamp

View Source
const GetCursorMethod = "getCursor"

GetCursorMethod returns a cursor to iterate the history of a thing The cursor MUST be released after use. The cursor will expire after not being used for the default expiry period.

View Source
const GetLatestMethod = "getLatest"

GetLatestMethod returns the latest values of a Thing.

View Source
const GetRetentionRuleMethod = "getRetentionRule"

GetRetentionRuleMethod returns the first retention rule that applies to the given value.

View Source
const GetRetentionRulesMethod = "getRetentionRules"

GetRetentionRulesMethod returns the collection of retention configurations

View Source
const ManageHistoryCap = "manageHistory"

ManageHistoryCap is the capabilityID for managing history

View Source
const ReadHistoryCap = "readHistory"

ReadHistoryCap is the capability ID to read the history

View Source
const ServiceName = "history"

ServiceName is the agent name of the default instance of the service

View Source
const SetRetentionRulesMethod = "setRetentionRules"

SetRetentionRulesMethod updates the set of retention rules

Variables

This section is empty.

Functions

This section is empty.

Types

type CursorArgs

type CursorArgs struct {
	// Cursor identifier obtained with GetCursor
	CursorKey string `json:"cursorKey"`
}

CursorArgs contain the cursor request for use in First,Last,Next,Prev

type CursorNArgs

type CursorNArgs struct {
	// Cursor identifier obtained with GetCursor
	CursorKey string `json:"cursorKey"`
	// Maximum number of results to return
	Limit int `json:"limit"`
}

CursorNArgs contains the request for use in NextN and PrevN

type CursorNResp

type CursorNResp struct {
	// Returns up to 'Limit' iterated values.
	// This will be an empty list when trying to read past the last value.
	Values []*thing.ThingValue `json:"values"`
	// There are still items remaining.
	ItemsRemaining bool `json:"itemsRemaining"`
}

CursorNResp contains the batch response to a cursor request

type CursorReleaseArgs

type CursorReleaseArgs struct {
	// Cursor identifier obtained with GetCursor
	CursorKey string `json:"cursorKey"`
}

type CursorSeekArgs

type CursorSeekArgs struct {
	// Cursor identifier obtained with GetCursor
	CursorKey string `json:"cursorKey"`
	// timestamp in msec since epoc to find
	TimeStampMSec int64 `json:"timeStampMSec"`
}

type CursorSingleResp

type CursorSingleResp struct {
	// The value at the new cursor position or nil if not valid
	Value *thing.ThingValue `json:"value"`
	// The current position holds a valid value
	Valid bool `json:"valid"`
}

CursorSingleResp contains a single response value to a cursor request

type GetCursorArgs

type GetCursorArgs struct {
	// Agent providing the Thing (required)
	AgentID string `json:"agentID"`
	// Thing providing the event to get (required)
	ThingID string `json:"thingID"`
	// Name of the event or action whose history to get
	// Use "" to iterate all events/action of the Thing.
	Name string `json:"name"`
}

GetCursorArgs request arguments:

type GetCursorResp

type GetCursorResp struct {
	// Cursor identifier
	// The cursor MUST be released after use.
	CursorKey string `json:"cursorKey"`
}

type GetLatestArgs

type GetLatestArgs struct {
	//	agentID is the ID of the agent that published the Thing values
	AgentID string `json:"agentID"`
	//	thingID is the ID of the thing whose history to read
	ThingID string `json:"thingID"`
	//	names is the list of properties or events to return. Use nil for all known properties.
	Names []string `json:"names"`
}

type GetLatestResp

type GetLatestResp struct {
	Values []*thing.ThingValue `json:"values"`
}

GetLatestResp returns the latest thing values

type GetRetentionRuleArgs

type GetRetentionRuleArgs struct {
	// AgentID is optional
	AgentID string `json:"agentID,omitempty"`
	// ThingID is optional
	ThingID string `json:"thingID,omitempty"`
	// Name of the event whose retention settings to get
	Name string `json:"name,omitempty"`
}

type GetRetentionRuleResp

type GetRetentionRuleResp struct {
	Rule *RetentionRule `json:"rule"`
}

type GetRetentionRulesResp

type GetRetentionRulesResp struct {
	Rules RetentionRuleSet `json:"rules"`
}

type RetentionRule

type RetentionRule struct {
	// Optional, the rule applies to data from this agent
	AgentID string `yaml:"agentID,omitempty" json:"agentID,omitempty"`

	// Optional, the rule applies to data from this thing
	ThingID string `yaml:"thingID,omitempty" json:"thingID,omitempty"`

	// Optional, the rule applies to events or actions with this name
	Name string `yaml:"name"`

	// Retain or not retain based on this rule
	Retain bool `yaml:"retain" json:"retain"`

	// Retention age after which to remove the value. 0 to retain indefinitely
	MaxAge uint64 `yaml:"maxAge"`
}

RetentionRule with a retention rule for an event (or action)

type RetentionRuleSet

type RetentionRuleSet map[string][]*RetentionRule

RetentionRuleSet is a map by event/action name with one or more rules for agent/things.

type SetRetentionRulesArgs

type SetRetentionRulesArgs struct {
	Rules RetentionRuleSet `json:"rules"`
}

Jump to

Keyboard shortcuts

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