Documentation ¶
Overview ¶
Package data implements Data API
Package senmltest implements senml testing utilities
Index ¶
- Constants
- func CompareRecords(r1 senml.Record, r2 senml.Record) (same bool)
- func CompareSenml(s1 senml.Pack, s2 senml.Pack) (same bool)
- func Diff_name_diff_types() senml.Pack
- func FromSenmlTime(t float64) time.Time
- func GetUrlFromQuery(q Query, id ...string) (url string)
- func Same_name_same_types(count int, stream registry.DataStream, decremental bool) senml.Pack
- func SupportedBackends(name string) bool
- func ToSenmlTime(t time.Time) float64
- type API
- type DenormMask
- type MQTTConnector
- type Manager
- type Query
- type RecordSet
- type RemoteClient
- type SqlStorage
- func (s *SqlStorage) CreateHandler(ds registry.DataStream) error
- func (s *SqlStorage) DeleteHandler(ds registry.DataStream) error
- func (s *SqlStorage) Disconnect() error
- func (s *SqlStorage) Query(q Query, streams ...*registry.DataStream) (pack senml.Pack, total *int, err error)
- func (s *SqlStorage) Submit(data map[string]senml.Pack, streams map[string]*registry.DataStream) (err error)
- func (s *SqlStorage) UpdateHandler(oldDS registry.DataStream, newDS registry.DataStream) error
- type Storage
- type Subscription
Constants ¶
const ( MaxPerPage = 1000 //value for ParamDenormalize TimeField = "time" TimeFieldShort = "t" NameField = "name" NameFieldShort = "n" UnitField = "unit" UnitFieldShort = "u" ValueField = "value" ValueFieldShort = "v" SumField = "sum" SumFieldShort = "s" )
const ( INFLUXDB = "influxdb" MONGODB = "mongodb" SENMLSTORE = "senmlstore" SQLITE = "sqlite" DRIVER_SQLITE3 = "sqlite3" )
Variables ¶
This section is empty.
Functions ¶
func CompareRecords ¶
func CompareRecords(r1 senml.Record, r2 senml.Record) (same bool)
func CompareSenml ¶
func CompareSenml(s1 senml.Pack, s2 senml.Pack) (same bool)
func Diff_name_diff_types ¶
func Diff_name_diff_types() senml.Pack
func FromSenmlTime ¶
func GetUrlFromQuery ¶
func Same_name_same_types ¶
func Same_name_same_types(count int, stream registry.DataStream, decremental bool) senml.Pack
func SupportedBackends ¶ added in v0.6.1
SupportedBackends returns true if the backend is listed as true
func ToSenmlTime ¶
Types ¶
type API ¶ added in v0.6.1
type API struct {
// contains filtered or unexported fields
}
API describes the RESTful HTTP data API
func (*API) Query ¶ added in v0.6.1
func (api *API) Query(w http.ResponseWriter, r *http.Request)
Query is a handler for querying data Expected parameters: id(s), optional: pagination, query string
func (*API) Submit ¶ added in v0.6.1
func (api *API) Submit(w http.ResponseWriter, r *http.Request)
Submit is a handler for submitting a new data point Expected parameters: id(s)
func (*API) SubmitWithoutID ¶ added in v0.6.1
func (api *API) SubmitWithoutID(w http.ResponseWriter, r *http.Request)
SubmitWithoutID is a handler for submitting a new data point Expected parameters: none
type DenormMask ¶
type DenormMask int
const ( FName DenormMask = 1 << iota FTime FUnit FValue FSum )
type MQTTConnector ¶
func NewMQTTConnector ¶
func NewMQTTConnector(storage Storage, clientID string) (*MQTTConnector, error)
func (*MQTTConnector) CreateHandler ¶ added in v0.6.1
func (c *MQTTConnector) CreateHandler(ds registry.DataStream) error
CreateHandler handles the creation of a new Data stream
func (*MQTTConnector) DeleteHandler ¶ added in v0.6.1
func (c *MQTTConnector) DeleteHandler(oldDS registry.DataStream) error
DeleteHandler handles deletion of a Data stream
func (*MQTTConnector) Start ¶ added in v0.6.1
func (c *MQTTConnector) Start(reg registry.Storage) error
func (*MQTTConnector) UpdateHandler ¶ added in v0.6.1
func (c *MQTTConnector) UpdateHandler(oldDS registry.DataStream, newDS registry.DataStream) error
UpdateHandler handles updates of a data stream
type Query ¶
type RecordSet ¶
type RecordSet struct { // SelfLink is the SelfLink of the returned recordset in the Data API SelfLink string `json:"selfLink"` // Data is a SenML object with data records, where // Name (bn and n) constitute the resource BrokerURL of the corresponding Data streams(s) Data senml.Pack `json:"data"` // Time is the time of query in seconds TimeTook float64 `json:"took"` //Next link for the same query, in case there more entries to follow for the same query NextLink string `json:"nextLink,omitempty"` //Total number of entries Count *int `json:"count,omitempty"` }
RecordSet describes the recordset returned on querying the Data API
type RemoteClient ¶
type RemoteClient struct {
// contains filtered or unexported fields
}
func NewRemoteClient ¶
func NewRemoteClient(serverEndpoint string, ticket *obtainer.Client) (*RemoteClient, error)
func (*RemoteClient) Query ¶
func (c *RemoteClient) Query(q Query, id ...string) (*RecordSet, error)
func (*RemoteClient) Submit ¶
func (c *RemoteClient) Submit(data []byte, contentType string, id ...string) error
Submit data for ingestion, where: data - is a byte array with actual data contentType - mime-type of the data (will be set in the header) id... - ID (or array of IDs) of data streams for which the data is being submitted
type SqlStorage ¶
type SqlStorage struct {
// contains filtered or unexported fields
}
SqlStorage implements a SqlDB storage client for HDS Data API
func NewSqlStorage ¶
func NewSqlStorage(conf common.DataConf) (storage *SqlStorage, disconnect_func func() error, err error)
func (*SqlStorage) CreateHandler ¶
func (s *SqlStorage) CreateHandler(ds registry.DataStream) error
CreateHandler handles the creation of a new DataStream
func (*SqlStorage) DeleteHandler ¶
func (s *SqlStorage) DeleteHandler(ds registry.DataStream) error
DeleteHandler handles deletion of a DataStream
func (*SqlStorage) Disconnect ¶
func (s *SqlStorage) Disconnect() error
func (*SqlStorage) Query ¶
func (s *SqlStorage) Query(q Query, streams ...*registry.DataStream) (pack senml.Pack, total *int, err error)
func (*SqlStorage) Submit ¶
func (s *SqlStorage) Submit(data map[string]senml.Pack, streams map[string]*registry.DataStream) (err error)
func (*SqlStorage) UpdateHandler ¶
func (s *SqlStorage) UpdateHandler(oldDS registry.DataStream, newDS registry.DataStream) error
UpdateHandler handles updates of a DataStream
type Storage ¶
type Storage interface { // Adds data points for multiple data streams // data is a map where keys are data stream ids // streams is a map where keys are data stream ids Submit(data map[string]senml.Pack, streams map[string]*registry.DataStream) error // Queries data for specified data streams //Query(q Query, page, PerPage int, streams ...*registry.DataStream) (senml.Pack, int, error) Query(q Query, streams ...*registry.DataStream) (pack senml.Pack, total *int, err error) // EventListener includes methods for event handling registry.EventListener }
Storage is an interface of a Data storage backend
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}