Documentation
¶
Index ¶
- Variables
- type Device
- type DeviceList
- type Position
- type Storage
- func (self *Storage) CheckNonce(nonce string) (bool, error)
- func (self *Storage) Close()
- func (self *Storage) DeleteDevice(devId string) (err error)
- func (self *Storage) GcDatabase(devId, userId string) (err error)
- func (self *Storage) GetDeviceInfo(devId string) (devInfo *Device, err error)
- func (self *Storage) GetDevicesForUser(userId string) (devices []DeviceList, err error)
- func (self *Storage) GetNonce() (string, error)
- func (self *Storage) GetPending(devId string) (cmd string, err error)
- func (self *Storage) GetPositions(devId string) (positions []Position, err error)
- func (self *Storage) GetUserFromDevice(deviceId string) (userId, name string, err error)
- func (self *Storage) Init() (err error)
- func (self *Storage) PurgePosition(devId string) (err error)
- func (self *Storage) RegisterDevice(userid string, dev Device) (devId string, err error)
- func (self *Storage) SetAccessToken(devId, token string) (err error)
- func (self *Storage) SetDeviceLocation(devId string, position Position) (err error)
- func (self *Storage) SetDeviceLock(devId string, state bool) (err error)
- func (self *Storage) StoreCommand(devId, command, cType string) (err error)
- func (self *Storage) Touch(devId string) (err error)
- type Unstructured
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDatabase = errors.New("Database Error")
View Source
var ErrUnknownDevice = errors.New("Unknown device")
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { ID string // device Id User string // userID Name string PreviousPositions []Position HasPasscode bool // is device lockable LoggedIn bool // is the device logged in Secret string // HAWK secret PushUrl string // SimplePush URL Pending string // pending command LastExchange int32 // last time we did anything Accepts string // commands the device accepts AccessToken string // OAuth Access token }
Device information
type DeviceList ¶
type Position ¶
type Position struct { Latitude float64 Longitude float64 Altitude float64 Accuracy float64 Time int64 Cmd map[string]interface{} }
Device position
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage abstration
func Open ¶
func Open(config *util.MzConfig, logger *util.HekaLogger, metrics *util.Metrics) (store *Storage, err error)
Open the database.
func (*Storage) CheckNonce ¶
Does the user's nonce match?
func (*Storage) DeleteDevice ¶
func (*Storage) GcDatabase ¶
Remove old postion information for devices. This previously removed "expired" location records. We currently only retain the latest record for a user.
func (*Storage) GetDeviceInfo ¶
Return known info about a device.
func (*Storage) GetDevicesForUser ¶
func (self *Storage) GetDevicesForUser(userId string) (devices []DeviceList, err error)
Get all known devices for this user.
func (*Storage) GetPending ¶
Get pending commands.
func (*Storage) GetPositions ¶
func (*Storage) GetUserFromDevice ¶
func (*Storage) PurgePosition ¶
remove all tracking information for devId.
func (*Storage) RegisterDevice ¶
Register a new device to a given userID.
func (*Storage) SetAccessToken ¶
func (*Storage) SetDeviceLocation ¶
Add the location information to the known set for a device.
func (*Storage) SetDeviceLock ¶
Shorthand function to set the lock state for a device.
func (*Storage) StoreCommand ¶
Store a command into the list of pending commands for a device.
Click to show internal directories.
Click to hide internal directories.