Commit e566984a authored by Axel Auweter's avatar Axel Auweter
Browse files

Implements the changes required for ticket #14

The SensorID type now includes a Rsvd field that is filled
by DCDBLib when saving data to avoid overflowing a Cassandra
key with more than 2^32 columns.
parent 7c1ea7d4
......@@ -62,7 +62,8 @@ typedef union {
*/
typedef struct {
uint64_t sensor_number : 16;
uint64_t device_id : 48;
uint64_t rsvd : 16;
uint64_t device_id : 32;
} DeviceSensorId;
/**
......
......@@ -120,7 +120,7 @@ void CassandraBackend::insert(string columnFamily, string key, uint64_t ts, uint
try {
ColumnParent cparent;
Column c;
string key, name, cvalue;
string name, cvalue;
cparent.column_family = columnFamily;
......
......@@ -108,6 +108,11 @@ void SensorDataStoreImpl::init(string hostname, int port) {
void SensorDataStoreImpl::insert(SensorId* sid, uint64_t ts, uint64_t value)
{
/* Calculate and insert week number */
uint16_t week = ts / 604800000000;
sid->dsid.rsvd = week;
/* Insert into Cassandra */
csBackend->insert(CF_SENSORDATA, sidConvert(sid), ts, value);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment