Awakening Eros: initial database concepts

This commit is contained in:
kayos 2021-05-07 20:37:48 -07:00
parent dbf01afb95
commit 9cca9814ae

@ -1,6 +1,47 @@
package eros
import (
"github.com/prologic/bitcask"
"protomolecule/src/dust"
"encoding/json"
)
var db *bitcask.Bitcask
// these values should be defined by config
var DataDir string = "./.eros-data"
// //
//
// Bitcask DB holds the devices captured during scanning
// Bitcask DB holds the devices captured during scanning
//
// MAC (Key)
// Device Local Name (LocalName)
// Raw Advertisement Packet (Advertisement)
// Services UUIDs (Services)
//
//this struct is to be marshalled into json before stored in bitcask
type Details struct {
LocalName string
Advertisement []byte
Services []string
}
// we use this to nest the populated Details struct associated with the MAC
type Device struct {
MAC string
Info Details
}
func Awaken() {
//log.Debug().Str("DataDir",DataDir).Msg("Initializing eros...")
db, err := bitcask.Open(DataDir)
if err != nil {
panic(err.Error)
}
}
func Remember(mac string, adv []byte, services []string) {
// placeholder
}