store

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package store implements the SIOT data store and processes messages. Currently data is stored in Genji and Influxdb. Direct DB access is not provided and all write data goes through NATS, thus making it easy to observe any data changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbSqlite added in v0.5.0

type DbSqlite struct {
	// contains filtered or unexported fields
}

DbSqlite represents a SQLite data store

func NewSqliteDb added in v0.5.0

func NewSqliteDb(dbFile string) (*DbSqlite, error)

NewSqliteDb creates a new Sqlite data store

func (*DbSqlite) Close added in v0.5.0

func (sdb *DbSqlite) Close() error

Close the db

type Meta

type Meta struct {
	ID      int    `json:"id"`
	Version int    `json:"version"`
	RootID  string `json:"rootID"`
}

Meta contains metadata about the database

type NewTokener added in v0.0.45

type NewTokener interface {
	NewToken(userID string) (string, error)
}

NewTokener provides a new authentication token.

type Params added in v0.3.0

type Params struct {
	File      string
	AuthToken string
	Server    string
	Key       NewTokener
	Nc        *nats.Conn
}

Params are used to configure a store

type Store added in v0.3.0

type Store struct {
	// contains filtered or unexported fields
}

Store implements the SIOT NATS api

func NewStore added in v0.3.0

func NewStore(p Params) (*Store, error)

NewStore creates a new NATS client for handling SIOT requests

func (*Store) Start added in v0.3.0

func (st *Store) Start() error

Start connects to NATS server and set up handlers for things we are interested in

func (*Store) StartMetrics added in v0.3.0

func (st *Store) StartMetrics(nodeID string) error

StartMetrics for various handling operations. Metrics are sent to the node ID given FIXME, this can probably move to the node package for device nodes

func (*Store) Stop added in v0.3.0

func (st *Store) Stop(err error)

Stop the store

func (*Store) StopMetrics added in v0.3.0

func (st *Store) StopMetrics(_ error)

StopMetrics ...

func (*Store) WaitStart added in v0.3.0

func (st *Store) WaitStart(ctx context.Context) error

WaitStart waits for store to start

Jump to

Keyboard shortcuts

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