https://github.com/koder77/l1vm-data
L1VM data base - exchange data between programs
https://github.com/koder77/l1vm-data
Last synced: 6 months ago
JSON representation
L1VM data base - exchange data between programs
- Host: GitHub
- URL: https://github.com/koder77/l1vm-data
- Owner: koder77
- License: gpl-3.0
- Created: 2021-04-30T16:48:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-22T16:16:24.000Z (almost 4 years ago)
- Last Synced: 2025-03-15T11:10:30.329Z (11 months ago)
- Language: C++
- Size: 122 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
L1VM DATA - 2022-02-22
======================
This software is copyrighted by Stefan Pietzonke aka koder77 2022.
NEW: "SEARCH DATA LIST" and "SEARCH NAME LIST" to get a list of entries:
```
$ nc 127.0.0.1 2020
STORE INT64
foo
12345
OK
STORE INT64
bar
6789
OK
STORE INT64
foobar
12345
OK
SEARCH DATA LIST
12345
data list length = 2
foo = 12345
foobar = 12345
OK
SEARCH NAME LIST
foobar
data list length = 1
foobar = 12345
OK
```
NEW: file "config.txt" contains a whitelist of IP addresses, which are allowed to connect
to the server. Add one IP address per line. And don't put a new line after the last entry!
This makes the data base a bit more safe!
L1vm-data is a simple database for sharing data stored in the l1vm-data server.
Worker programs can access this data and share it as global memory.
There are three commands:
STORE, GET and REMOVE
The "STORE INT64" command store a 64 bit signed integer into the database.
The command must be send over a TCP/IP socket (port 2020) and end with a "\n" newline character like this:
STORE INT64
foobar
42
The variable foobar gets stored with a value of "42".
you can connect to the data base via "nc" on Linux for example:
$ nc localhost 2020
$ STORE INT64
$ foobar
$ 42
$ OK
TO get a variable use the GET command:
$ GET INT64
$ foobar
$ 42
$ OK
To read and remove a variable use the REMOVE command.
The commands list:
STORE BYTE store variables
STORE STRING
STORE INT64
STORE DOUBLE
GET BYTE get(read) variables
GET STRING
GET INT64
GET DOUBLE
REMOVE BYTE remove (read and remove) variables
REMOVE STRING
REMOVE INT64
REMOVE DOUBLE
SEARCH DATA search in database for data
SEARCH DATA LIST return a list of matching data
SEARCH NAME LIST return a list of matching names
GET INFO get variable real name and data type
LOGOUT disconnect from server
SAVE save a data base
LOAD load a data base
The GET/REMOVE commands also are working with "regular expressions":
GET INT64
foobar.*
42
OK
The variable: "foobar-1234" would be get. The ".*" stand for every possible chars
on any length. So anything starting with "foobar" would be found.
Usage:
$ l1vm-data 1000000
Makes space for 1000000 elements. The variable names are set to max 127 chars.
This server database was developed for use in home nets only! There is no way to protect data stored in the database.
So everything inside will be accessible from a connected client!!!
NEW EXAMPLES 3N1 calc
=====================
The 3n1 calc test:
Check if a number is even: if it is even then divide by two, if it is odd then multiply by three
and add one. Every start number should give a one as the final result!
Run the "l1vm-data" database server:
$ ./l1vm-data -p 2020
Run the L1VM server init program:
$ l1vm-jit 3n1-server
And finally the 3n1 worker client:
$ l1vm-jit 3n1-client -args 10 198
At the end with a terminal program connected to the server we can check the results:
$ nc localhost 2020
GET INT64
3n1-100
1
Get info of variable:
$ nc localhost 2020
GET INFO
3n1-.*
3n1-1
INT64
OK
So the "GET INFO" and "3n1-.*" was used as input to the database.
And the following lines are the output.
SEARCH DATA
===========
The data base can be searched for a data match.
If the searched data is in the data base then the name of the data
entry will be returned.
The following example creates two data sets: an INT64 and a STRING type:
$ nc localhost 2020
STORE INT64
foo
123456
OK
STORE STRING
hello
Hello world!
OK
SEARCH DATA
world
hello
OK
SEARCH DATA
123456
foo
OK
SAVE/LOAD
========
SAVE
test.l1db
OK
LOAD
test.l1db
OK
To save/load a data base you use two input lines for the commands as above!
Have some fun!! :)