📜 ⬆️ ⬇️

another bike or TreeDb - NoSQL Database startup

I want to introduce the start of the project, with the working title TreeDb. I do not PR (still far away ...) and post my thoughts and reasoning in a personal blog. I want to receive in response to an adequate criticism, discussion of ideas, in general, everything for which blogs are needed;). Simply, it is interesting to trace the history of the project, what was planned and what was the outcome. And maybe someone wants to participate. Always Glade.

From the title it is clear that we will focus on the database, based on trees. Immediately make a reservation - at the moment there is not a single line of code. First, I define the concept.

below FAQ

a little about terminology:
')
Key - a unique identifier that uniquely identifies some (specific) data.
the key may contain characters \ w [azAZ09_] *
* - perhaps this restriction will be lifted or extended in the future to [th]. Please do not find fault with this.
The key can be full or short.

The short key is the name of the node, unique within a given level. And if to put it more precisely - as part of one Parent node there should be only unique names of the child nodes (In one big family there are no identical names among brothers and sisters) Simple key example A1, B2, C3

The full key is the names of all the parent nodes sequentially across the dot.
An example of the full key A1.B2.C3 is the name of the Node C3, its parent B2, and its parent parent A1

Data - a certain sequence of bytes that must be remembered and issued on request. data can be both alphanumeric and binary.

A node (node) is a uniquely-defined key collection of data and child nodes. in other words, a Node contains the name (key), data, and references to child nodes.

A child node is a node contained in the Parent node and having one connection. Butter oil.

The child node may be unnamed, that is, a digital key is assigned to it automatically in the order of receipt. see example ...

The root node is practically nonexistent, there are first level nodes. Theoretically, it should exist.

Exchange Protocol Description


It is based on the memcached exchange protocol. At first, only two commands are planned to be implemented: get & set

1) Write node A1
set A1,<data_len> \r\n
\r\n
>stored error *
*- Ok $

:
set A1,5
12345
>stored

2)
set (<node_name>,<data_len>)+ \r\n
\r\n
>stored
....
\r\n
>stored*
*- ?

:
set A1,5 A2,5 A3,5
12345
>stored
67890
>stored
abcde
>stored


3) A1
g et A1\r\n
>A1 5
>12345\r\n
>ok *
*- ? (optional)

4) A1,A2,A3
g et A1,A2,A3\r\n
>A1 5
>12345\r\n
>A2 5
67890
>A2 5
abcde
>ok *
*- ?

5) A ( ?)
set A.# 5,5,5
12345
>stored
67890
>stored
abcde
>stored
, : #1,#2,#3
, : #4,#5,#6

6) A
get A.#
> A.#1,A.#2,A.#3
>ok

7) A
get A.*
>A.#1 5
>12345\r\n
>A.#2 5
>67890\r\n
>A.#3 5
>abcde
>ok

8) A
*-
set A: B1,5 B2,5 B3,5
12345
>stored
67890
>stored
abcde
>stored

:
set A.B1,5 A.B2,5 A.B3,5

a.*.b.*,
a..b.* a..*.*

, .

FAQ

?
, ... .

?
, ...
- .
,
.

?
, , .
.
.

?
. , .
libevent

, ?
.
. , .

?
. - ,
key-value .
, - .

?
- 32 .

?
32 - ... 16?

?
, . , - !

UPDATE?
set

?
, , .
, - .

?
, ... ...
- .
set A1,<data_len> \r\n
\r\n
>stored error *
*- Ok $

:
set A1,5
12345
>stored

2)
set (<node_name>,<data_len>)+ \r\n
\r\n
>stored
....
\r\n
>stored*
*- ?

:
set A1,5 A2,5 A3,5
12345
>stored
67890
>stored
abcde
>stored


3) A1
g et A1\r\n
>A1 5
>12345\r\n
>ok *
*- ? (optional)

4) A1,A2,A3
g et A1,A2,A3\r\n
>A1 5
>12345\r\n
>A2 5
67890
>A2 5
abcde
>ok *
*- ?

5) A ( ?)
set A.# 5,5,5
12345
>stored
67890
>stored
abcde
>stored
, : #1,#2,#3
, : #4,#5,#6

6) A
get A.#
> A.#1,A.#2,A.#3
>ok

7) A
get A.*
>A.#1 5
>12345\r\n
>A.#2 5
>67890\r\n
>A.#3 5
>abcde
>ok

8) A
*-
set A: B1,5 B2,5 B3,5
12345
>stored
67890
>stored
abcde
>stored

:
set A.B1,5 A.B2,5 A.B3,5

a.*.b.*,
a..b.* a..*.*

, .

FAQ

?
, ... .

?
, ...
- .
,
.

?
, , .
.
.

?
. , .
libevent

, ?
.
. , .

?
. - ,
key-value .
, - .

?
- 32 .

?
32 - ... 16?

?
, . , - !

UPDATE?
set

?
, , .
, - .

?
, ... ...
- .
set A1,<data_len> \r\n
\r\n
>stored error *
*- Ok $

:
set A1,5
12345
>stored

2)
set (<node_name>,<data_len>)+ \r\n
\r\n
>stored
....
\r\n
>stored*
*- ?

:
set A1,5 A2,5 A3,5
12345
>stored
67890
>stored
abcde
>stored


3) A1
g et A1\r\n
>A1 5
>12345\r\n
>ok *
*- ? (optional)

4) A1,A2,A3
g et A1,A2,A3\r\n
>A1 5
>12345\r\n
>A2 5
67890
>A2 5
abcde
>ok *
*- ?

5) A ( ?)
set A.# 5,5,5
12345
>stored
67890
>stored
abcde
>stored
, : #1,#2,#3
, : #4,#5,#6

6) A
get A.#
> A.#1,A.#2,A.#3
>ok

7) A
get A.*
>A.#1 5
>12345\r\n
>A.#2 5
>67890\r\n
>A.#3 5
>abcde
>ok

8) A
*-
set A: B1,5 B2,5 B3,5
12345
>stored
67890
>stored
abcde
>stored

:
set A.B1,5 A.B2,5 A.B3,5

a.*.b.*,
a..b.* a..*.*

, .

FAQ

?
, ... .

?
, ...
- .
,
.

?
, , .
.
.

?
. , .
libevent

, ?
.
. , .

?
. - ,
key-value .
, - .

?
- 32 .

?
32 - ... 16?

?
, . , - !

UPDATE?
set

?
, , .
, - .

?
, ... ...
- .

Source: https://habr.com/ru/post/80928/


All Articles