This guide will walk you through the entire process of setting up τ, running the server, and interacting with it using the REPL client. By the end, you'll have a running database and will have performed basic data operations.
Installation
First, you need to install τ by building it from source. This process requires git and the zig compiler. If you haven't installed it yet, please follow the Installation Guide.
The key steps are:
- Clone the repository.
- Run
zig buildto compile the server and client.
Start the Server
Once τ is built, you can start the database server. The server process runs in the foreground and listens for client connections.
From the tau-db project directory, run:
1zig build run-server1[info] Server listening on 127.0.0.1:7828Keep this terminal window open. The server must be running to accept client connections. For more details, see the Server & REPL Guide.
Connect with the REPL
With the server running, open a new terminal window and start the REPL client.
1zig build run-replOnce the REPL starts, use the .connect command to establish a connection with the server.
1τ> .connect
2Connected to 127.0.0.1:7828
3τ>Create a Schedule
Now that you're connected, let's create a Schedule. A Schedule is a time-series data structure that stores events.
Let's create a schedule to track temperature readings.
1τ> create_schedule temperature
2OKYou can learn more about this primitive in the Frame documentation (Schedules are a component of Frames).
Append Data
With our temperature schedule created, let's add some data to it. The append command adds an event to a schedule with a value, a valid time, and an expiry time.
Let's add three temperature readings. The timestamps are provided in nanoseconds.
1τ> append temperature 22.5 1000000000 9999999999999999999
2OK
3τ> append temperature 23.1 2000000000 9999999999999999999
4OK
5τ> append temperature 22.8 3000000000 9999999999999999999
6OKWe've now stored three temperature readings at three different points in time.
Query Your Data
The final step is to query the data back. You can use the at command to see the value of a schedule at a specific point in time.
What was the temperature at t=2.5s?
1τ> at temperature 2500000000
223.1τ correctly interpolates the value between the events at 2 and 3 seconds.
You can also query a range of values.
1τ> range temperature 1000000000 3000000000
2(1000000000, 22.5)
3(2000000000, 23.1)
4(3000000000, 22.8)Next Steps
You've successfully installed τ, created a schedule, appended data, and run queries. You're now ready to explore its more advanced features.
- Core Concepts: Learn about Frames and the Lens engine.
- API: See the full list of operations in the API Commands Reference.
- Guides: Configure Storage Backends for data persistence.