Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

feat(docs): data structure and example #59

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 deletions .img/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<img alt="iroh" src="./.img/logo.svg" width="150" />
<img alt="time-trace" src="./.img/logo.svg" width="150" />

# Time Trace
## TimeTrace

Time trace is an In memory event or log, storage and stream platform.
Which you can use to store and stream your service logs, events and ...
Some of use cases of ttrace is storing and streaming price and other stuff in fintech services, storing IoT projects events (events from different devices) and also your project logs.
[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/EvYB9ZgYvV)

# Full Documentation
> SOON
Time-trace is a software which allow you to store and stream your service logs, events and ..., in real-time.
When you are using time-trace you are using a completely new data structure and model which is strongly mixed with time.


### DOCs

[Documentation](./doc/main.md)
File renamed without changes.
Empty file added doc/config/.keep
Empty file.
11 changes: 11 additions & 0 deletions doc/main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Time Trace Documentation

Time-trace is a software which allow you to store and stream your service logs, events and ..., in real-time.
When you are using time-trace you are using a completely new data structure and model which is strongly mixed with time.

In this documentation we have different parts:

* [model](./model/) (which is talk about data structure of time-trace and also some use case examples).
* [config](./config/) (which is show you how config works in time-trace).
* [TQL](./TQL/) (time query language).
* [usage](./usage/) (which is show how can you use time-trace in action).
75 changes: 75 additions & 0 deletions doc/model/model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Model

In time-trace data model we have 3 main concepts, Sets, Sub-sets ans Elements. The first important thing you should consider when read this document is to don't confuse this with sets in math, they are similar and have same name, but not completely same.

## Element

Elements in time-trace is name of each separated data we are save and stream. each element has 2 field, value and time.

Something like this:
```
[value, time]
```

And this is how they look likes in code:
```go
type Element struct {
value string
time time.Time
}
```

## Sub-Set

Sub-sets is a set of Elements in a array. we can have similar elements (similar value) in same sub-set.

Something like this:
```
[someDate, time-1]
[anotherData, time-2]
[someData, time-3]
[firstValue, time-4]
[secondValue, time-5]
[aValue, time-6]
[aValue, time-7]
```

And this is how it look likes in code:
```go
type SubSet []Element
```

## Set

Sets is a map of string to sub-sets, the string is name of each sub-set (each set itself has a name).

Something like this:
```
Set[goldPrice]:
sub-set[AUD] # GOLD/AUD price
sub-set[USD] # GOLD/USD price
```

And this is how it look likes in code:
```go
type Sets map[string]Set
type Set map[string]SubSet
```

## Examples

Before starting you can check [types](../../core/database/types.go) to understand the main 3 concepts better if you wish.

Now we are going to show an example of how it works. our example is for a fintech service for store and stream prices.
(other use cases of time-trace can be IoT, multiplayer games and saving services logs, but we are going to explain it with an fintech example).

In this example our service going to show and store prices of gold (and other stuff). so, we can start by making our database and name it `price-service` in config.
Then we make a Set and assign `GOLD` name to it. each sub set of this set is name of one currency, like AUD, EUR, USD and ...
Each element of each sub-set is the live price of GOLD/SUB-SET-NAME-CURRENCY in value, and the default time.

Like:
```
Set: GOLD
Sub-set: USD
Element example: ["1,970.30", 1698228966]
```
Empty file added doc/usage/.keep
Empty file.