@iobroker/db-objects-file 4.0.0-alpha.8-20210909-001a711c → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -1
- package/lib/objects/objectsInMemFileDB.js +228 -112
- package/lib/objects/objectsInMemServerClass.js +2 -26
- package/lib/objects/objectsInMemServerRedis.js +292 -109
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,6 +1,119 @@
|
|
|
1
1
|
# File objects DB base classes for ioBroker
|
|
2
2
|
The Library contains the Database classes for File based objects database client and server.
|
|
3
3
|
|
|
4
|
+
## Redis simulator
|
|
5
|
+
The objects db client is always a redis client, but if the database type is file, it will communicate with a built-in redis simulator instead of a real redis db.
|
|
6
|
+
|
|
7
|
+
In the js-controller we use [ioredis](https://github.com/luin/ioredis), the library supports all redis commands by simply calling them on the client instance, like `redis.set("foo", "bar")`.
|
|
8
|
+
For an explanation of the commands in native redis, we refer to the [redis documentation](https://redis.io/commands).
|
|
9
|
+
|
|
10
|
+
Currently, the following commands are supported by the simulator for objects db:
|
|
11
|
+
|
|
12
|
+
### Namespaces
|
|
13
|
+
The simulator supports four different namespaces:
|
|
14
|
+
|
|
15
|
+
- files (default: `cfg.f.`)
|
|
16
|
+
- objects (default: `cfg.o.`)
|
|
17
|
+
- sets (default: `cfg.s.`)
|
|
18
|
+
- meta (default: `meta.`)
|
|
19
|
+
|
|
20
|
+
### Overview: Objects db and general functionalities
|
|
21
|
+
| Command | State of integration | namespace |
|
|
22
|
+
| ----------- | ----------- | ----------- |
|
|
23
|
+
| quit | full | independent |
|
|
24
|
+
| script | partial | independent |
|
|
25
|
+
| evalsha | full | independent |
|
|
26
|
+
| publish | full | objects, meta |
|
|
27
|
+
| mget | full | objects, files |
|
|
28
|
+
| get | full | objects, files, meta |
|
|
29
|
+
| set | full | objects, files, meta |
|
|
30
|
+
| del | full | objects, files |
|
|
31
|
+
| exists | full | objects, files, sets |
|
|
32
|
+
| scan | full | objects, files, sets |
|
|
33
|
+
| keys | full | objects, files, sets |
|
|
34
|
+
| psubscribe | full | objects, meta |
|
|
35
|
+
| punsubscribe | full | objects |
|
|
36
|
+
| config | dummy | independent |
|
|
37
|
+
| client | partial | independent |
|
|
38
|
+
| multi/exec | partial | independent |
|
|
39
|
+
| sadd | dummy | independent |
|
|
40
|
+
| srem | dummy | independent |
|
|
41
|
+
| sscan |full | objects, files, sets |
|
|
42
|
+
|
|
43
|
+
### Overview: File db specific
|
|
44
|
+
| Command | State of integration |
|
|
45
|
+
| ----------- | ----------- |
|
|
46
|
+
| mget | full |
|
|
47
|
+
| get | full |
|
|
48
|
+
| set | full |
|
|
49
|
+
| rename | full |
|
|
50
|
+
| del | full |
|
|
51
|
+
| exists | full |
|
|
52
|
+
| scan | full |
|
|
53
|
+
| keys | full |
|
|
54
|
+
|
|
55
|
+
### quit
|
|
56
|
+
This will close the connection.
|
|
57
|
+
|
|
58
|
+
### script
|
|
59
|
+
When receiving a script, the server mocks the methods `load` and `exists`, load will store a `func`or `design` script in memory. On an `exists` request, the server will return all known scripts.
|
|
60
|
+
|
|
61
|
+
### evalsha
|
|
62
|
+
Evalsha can be used to execute a stored script.
|
|
63
|
+
|
|
64
|
+
### publish
|
|
65
|
+
On publish the server will publish to all clients who have subscribed to the objects, just like redis does.
|
|
66
|
+
|
|
67
|
+
### mget
|
|
68
|
+
`mget` is used to receive multiple objects/files from the server.
|
|
69
|
+
|
|
70
|
+
### get
|
|
71
|
+
`get` is used to receive a single object/file from the server.
|
|
72
|
+
|
|
73
|
+
### set
|
|
74
|
+
`set` is used to set an object/file to the database.
|
|
75
|
+
|
|
76
|
+
### rename
|
|
77
|
+
`rename` allows renaming a `file`.
|
|
78
|
+
|
|
79
|
+
### del
|
|
80
|
+
`del` deletes a given object/file from the db.
|
|
81
|
+
|
|
82
|
+
### exists
|
|
83
|
+
`exists` checks if a given object/file exists in the database. For sets this is just a dummy.
|
|
84
|
+
|
|
85
|
+
### scan
|
|
86
|
+
`scan` is just like `keys` and returns all matching keys, but addtionally it returns the counter (always 0) to satisfy the redis client.
|
|
87
|
+
For sets this is just a dummy.
|
|
88
|
+
|
|
89
|
+
### keys
|
|
90
|
+
It returns all matching keys. For sets this is just a dummy.
|
|
91
|
+
|
|
92
|
+
### psubscribe
|
|
93
|
+
Subscribes for a pattern to receive object changes.
|
|
94
|
+
|
|
95
|
+
### punsubscribe
|
|
96
|
+
Unsubscribes a pattern to no longer receive object changes.
|
|
97
|
+
|
|
98
|
+
### config
|
|
99
|
+
Mainly a dummy, just sends a positive response if `lua-time-limit` change received.
|
|
100
|
+
|
|
101
|
+
### client
|
|
102
|
+
Is used to handle `setname` and `getname` requests. `setname` is used to change the logging namespace. On `getname` the server will respond with the current connection name, which has been set via `getname`.
|
|
103
|
+
|
|
104
|
+
### multi/exec
|
|
105
|
+
Multi/exec is fully integrated but only works with pipelines and will give a piped response. It will not respond until `exec` is called.
|
|
106
|
+
On `exec` the simulator responds with `OK` (for `multi`), `QUEUED` for every command and the real results as an array for `exec`.
|
|
107
|
+
|
|
108
|
+
### sadd
|
|
109
|
+
Just a dummy, always responds with `1`, which means we have added the item to the set.
|
|
110
|
+
|
|
111
|
+
### srem
|
|
112
|
+
Just a dummy, always responds with `1`, which means we have removed the item from set.
|
|
113
|
+
|
|
114
|
+
### sscan
|
|
115
|
+
Does the same as `scan`.
|
|
116
|
+
|
|
4
117
|
## License
|
|
5
118
|
Apache 2.0
|
|
6
|
-
Copyright 2018-
|
|
119
|
+
Copyright 2018-2022 bluefox <dogafox@gmail.com>
|