diff --git a/README.md b/README.md index 54ca280..c208b1e 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,9 @@ Solaris is a cloud service primarily built for storing a large amount of data in If scale or data size is not a factor, but simplicity and speed are still required, Solaris can be run in a stand-alone configuration. In this configuration, there are no dependencies on any external services. The stand-alone Solaris instance can be run in a Docker container, as a Kubernetes instance, or even on a local machine to serve as the streaming database for a small amount of data (that may fit into the local filesystem) or as part of the development environment. In this case, Solaris is very lightweight, fast, and easy to run (as it consists of a single executable). +### Documentation +See https://solarisdb.github.io/docs + ## License This project is licensed under the Apache Version 2.0 License - see the [LICENSE](LICENSE) file for details diff --git a/docs/api.md b/docs/api.md deleted file mode 100644 index 79a5669..0000000 --- a/docs/api.md +++ /dev/null @@ -1,50 +0,0 @@ -## CURLing the API -Below are examples of how to use CURL to call the **Solaris** API. - -##### GET /logs -Retrieve existing logs -``` -curl -v -s -G -XGET "http://localhost:8080/v1/logs?limit=10" | jq -``` - -##### GET /logs (with filters) -Retrieve existing logs with filters -``` -curl -v -s -G -XGET --data-urlencode "logsCondFilter=tag('a')='b' and tag('c')='d'" "http://localhost:8080/v1/logs?limit=10" | jq -``` - -##### POST /logs -Create a new log -``` -curl -v -s -XPOST -H "content-type: application/json" -d '{"tags":{"a":"b", "c":"d"}}' "http://localhost:8080/v1/logs" | jq -``` - -##### DELETE /logs -Delete logs by filter condition -``` -curl -v -s -XDELETE -H "content-type: application/json" -d '{"filterCondition":"logID = \"01HV6Y4YTNPC64VDYBDF1VW3KM\" or tag(\"a\")=\"b\""}' "http://localhost:8080/v1/logs" | jq -``` - -##### PUT /logs/{id} -Update log tags -``` -curl -v -s -XPUT -H "content-type: application/json" -d '{"tags":{"a":"b", "c":"e"}, "records":"100"}' "http://localhost:8080/v1/logs/01HV523WYP0ZSDAYEJ4JNED6F7" | jq -``` - -##### POST /logs/{id}/records -Add records to the log -``` -curl -v -s -XPOST -H "content-type: application/json" -d "{\"records\":[{\"payload\":\"`echo 'data123' | base64`\"}, {\"payload\":\"`echo 'data456' | base64`\"}]}" http://localhost:8080/v1/logs/01HV523WYP0ZSDAYEJ4JNED6F7/records | jq -``` - -##### GET /records -Retrieve existing records -``` -curl -v -s -G -XGET "http://localhost:8080/v1/records?limit=10" | jq -``` - -##### GET /records (with filters) -Retrieve existing records with filters -``` -curl -v -s -G -XGET --data-urlencode "logsCondFilter=tag('a')='b' and tag('c')='d' or logID = '01HV6YH47B2MQBAPRTYV9KB7ZK'" --data-urlencode "recordsCondFilter=ctime > '2024-04-11T16:06:40.63Z' and ctime < '2024-04-11T16:06:51.59Z'" "http://localhost:8080/v1/records?limit=10" | jq -``` diff --git a/docs/expressions.md b/docs/expressions.md deleted file mode 100644 index 7d5e273..0000000 --- a/docs/expressions.md +++ /dev/null @@ -1,90 +0,0 @@ -# Expressions Query Language (QL) -Solaris allows you to specify filters for selecting logs and their records in the form of Boolean expressions. An expression is a text that contains constants, arguments, and operations that form the query for selecting logs and their records. We will try to explain it briefly here so that the reader can apply it immediately. - -QL is a very simple language for writing boolean expressions. For example: - -to select logs with tag "abc"="def" or for the log with ID="1234123421342343": -``` -tag('abc') = tag("def") OR logID = "1234123421342343" -``` - -to select records created between February 12, and March 11 12:34:43 of 2024: -``` -ctime < "2024-03-11 12:34:43.000" AND ctime > "2024-02-12 00:00:00.000" -``` - -## Arguments -An argument is a value, which can be referenced by one of the following forms: -- constant -- identifier -- function -- list of constants - -### Constant values -QL supports one type of constants - string. The string constant is a text in double or single quotes. The numbers are either natural or real numbers. - -String constants examples: -``` -'' -"" -"Hello world" -'Andrew said: "Hello!"' -``` - -### Identifiers -Identfier is a variable, which adressed by name. QL supports the following identifiers: -- `logID` - the log unique identifier. -- `ctime` - the record created time (every record gets its ctime when it is added to the log). For `ctime` only the `<` and `>` operations are allowed. - -### Functions -A function is a value that is calculated from the arguments provided. It looks like an identifier followed by arguments in parentheses. The argument list may be empty. - -Solaris supports the following functions: -- `tag()` - returns the tag value for a log. Name could be a string constant or any other argument value - -### List of constants -Some constants maybe grouped in a list. The List defined like the coma-separated constants in between `[` and `]`: - -``` -["a", "b", 'c'] -``` -the list of three string constants - "a", "b" and "c" - -## Operations -Operation is an action which requires two arguments. All operations return either TRUE or FALSE - -Examples: -``` -'1234' = '234' // compares two string constants, the result will be FALSE -logID != "123" // compares log ID with the string "123", the result depends on the logID value -tag("t1") > tag("t2") // compares value of the tag t1 with the value of the tag t2, the result depends on the tags values -tag("t1") IN ["1", "2", "3"] // the value of t1 is either "1", "2", or "3" -tag("t1") LIKE 'abc%' // matches the value of tag t1 against the pattern 'abc%', where '%' is a wildcard that matches any sequence of characters -``` - -QL supports the following operations: - -"<", ">", "<=", ">=", "!=", "=" - -| Operation | Description | -|-----------|-------------------------------------------------------------------------------------------------------------| -| < | The left argument is less than the right one | -| > | The left argument is greater than the right one | -| <= | The left argument is less or equal to the right one | -| >= | The left argument is greater or equal to the right one | -| != | The left argument is not equal to the right one | -| = | The left argument is equal to the right one | -| IN | The left argument value is in the list. Right argument must be a list | -| LIKE | The left argument should be like the constant (second argument). The operation is similart to the SQL like. | - -## QL boolen expression -The QL expression is the series of boolean values that can be combined by AND, OR, NOT boolean operations and the parenthesis to increase the priority. - -Examples: -``` -tag('t1') != tag('t2') OR tag('t1') = 'abc' -ctime > "2024-02-12 00:00:00.000" AND ctime < "2024-03-12 00:00:00.000" -``` - -## That is it -With all the information above you can define a filter in a form of QL boolean expression. \ No newline at end of file