Open sidnt opened 4 years ago
the next concept comes up, of databases. It's said that
One Env can store many different databases
but what details does that translate to?
Interestingly, an environment creation needs to know at the outset, how many databases we might actually use. Which is a bit weird of an api. How can I calculate beforehand how many databases i might need, and that, without actually knowing what actually is a database abstraction and whether it can be eliminated, so that I can serve all my needs in only one database, and so i'm free of this abstraction.
before using lmdb in scala, we should understand the abstractions it offers and what could that mean for us, while translating the lmdbjava api to zio.
an lmdb environment is like the memory area, which an lmdb instance, ie, an lmdb-process operates on. an lmdb environment is like a data structure, which is in complete handle of an lmdb-process. lmdb-environment is like the root/starting handle of the process. it's the first contact, that an lmdb-process, establishes with an lmdb-environment file.
the creation of an lmdb-environment can be parameterized with constraints to be followed in that lmdb-process' behaviour. these are like the top level constraints, that remain consistent, during the entire life of a process, fundamentally altering its behaviour.
For example, one of the constraints is,
Putting a hard upper limit on the size of the environment, or iow, for the size of the on disk storage file.
So you instantiate the parameter-values for the environment you want, and then, open the environment on an on disk-file.
The same path, ie, the same environment, can be concurrently opened and used in a different lmdb-process.
So, can an lmdb-environment become a memory hub for inter-process communication?
Ideally, open a path, only once per process.