njaard / sonnerie

A simple timeseries database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Basic curl put command failing

ronniec95 opened this issue · comments

Trying to run the example curl command fails

curl -X PUT http://localhost:5555/ --data-binary 'fibonacci 2020-01-07T00:00:00 u 13'
parsing timestamp invalid digit found in string

This is running the basic sonnerie-serve

Adding/retrieving data using sonnerie read / add works fine

The root cause appears to be that in sonnerie-serve you parse i64 nanosecond timestamps on line 138

                let ts: Timestamp = timestamp
                    .parse()
                    .map_err(|e| format!("parsing timestamp {}", e))?;

where Timestamp is pub type Timestamp = u64

I assume the UNIX_EPOCH is an opaque value to the client, though sending timestamps through like that does indeed work.

This is unfortunate! I suppose maybe the timestamp format could be specified on the query string.

To close the issue, update the readme to tell the user that timestamps need to be specified in nanoseconds since 1/1/1970 when using http or update the code so it s accepts the same format as the local binary.

I haven't tested read operation via http with dates but I suspect it will also need similar adjustment

I have updated the readme, thank you for reporting.