database

package
v0.0.0-...-4bd5384 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("key not found")

Functions

This section is empty.

Types

type DB

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

func Open

func Open(path string) (*DB, error)

func (*DB) Close

func (db *DB) Close()

func (*DB) Get

func (db *DB) Get(key string, value interface{}) error

Get performs a key lookup in the store and returns the value. It handles decoding the value into the interface provided using msgPack.

func (*DB) GetSensorInfo

func (db *DB) GetSensorInfo(name string) (gears.SensorInfo, error)

func (*DB) Iterate

func (db *DB) Iterate(from, to string, value interface{}, fun func(key string) error) error

Iterate over a key range, start inclusive, end exclusive. The value is always placed into the 'value' interface in order to allow typing. If fun returns an error the iteration is aborted.

func (*DB) NewProcessor

func (db *DB) NewProcessor() func(chan gears.RFMessage)

func (*DB) Put

func (db *DB) Put(key string, value interface{}) error

Puts a new value into the database. Handles encoding using msgPack. Putting nil deletes an existing key-value pair

func (*DB) PutRFMessage

func (db *DB) PutRFMessage(m gears.RFMessage) error

func (*DB) PutSensorInfo

func (db *DB) PutSensorInfo(name string, m gears.SensorInfo) error

func (*DB) PutSensorValue

func (db *DB) PutSensorValue(name string, m gears.SensorDataValue) error

func (*DB) RFIterate

func (db *DB) RFIterate(start, end int64, handle func(m gears.RFMessage) error) error

func (*DB) RFPublish

func (db *DB) RFPublish(m gears.RFMessage)

func (*DB) RFSubscribe

func (db *DB) RFSubscribe(start int64) chan gears.RFMessage

func (*DB) RFUnsubscribe

func (db *DB) RFUnsubscribe(c chan gears.RFMessage)

func (*DB) SensorIterate

func (db *DB) SensorIterate(name string, start, end int64,
	handle func(m gears.SensorDataValue) error) error

func (*DB) SensorPublish

func (db *DB) SensorPublish(name string, m gears.SensorDataValue)

Push a sensor message, which stores it in the database and forwards it to all sensorSubscribers.

func (*DB) SensorSubscribe

func (db *DB) SensorSubscribe(name string, start int64) chan gears.SensorDataValue

Subscribe to Sensor messages starting at the timestamp given by start in milliseconds since the epoch, returns a channel to read messages from.

func (*DB) SensorUnsubscribe

func (db *DB) SensorUnsubscribe(c chan gears.SensorDataValue)

Unsubscribe the given channel from sensor messages. This will (asynchronously) cause the channel to be closed.

Jump to

Keyboard shortcuts

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