Using the NIF database backend
Currently, the Mnesia based backend is the default, therefore you have to specify a command line argument if you would like to use the NIF based backend.
After the system is installed, start RefactorErl with
bin/referl -db nif
NIF uses the RefactorErl data directory to store its data. You can specify it by typing
bin/referl -db nif -dir /path/to/your/data/dir
If you would like to start several instances of RefactorErl/NIF, you have to choose different node names. It is also suggested to set different data directories as well, although it is not strictly required.
bin/referl -db nif -sname name1 -dir /path/to/your/data/dir1
bin/referl -db nif -sname name2 -dir /path/to/your/data/dir2
# or
bin/referl -db nif -name name1 -dir /path/to/your/data/dir1
bin/referl -db nif -name name2 -dir /path/to/your/data/dir2
After the system starts up, you can use is it like with the MNESIA database backend, but there are some extra functions. (For further informations see: ri)
Backup-system example
After the system is started, the following operations work on the full database.
Graph operations example
With the NIF database, you may have more graphs. The graphs does not affect each other, so every graph has its own database, and backups, etc. After restarting the tool, the last used graph will be loaded. Let's see an example:
If something happened to database, then after start up you will get a message about it and a new default graph will be created. If refactorerl_0 exists, then refactorerl_1 will be created, and so on. The corrupted database will not be deleted by the system. If the user wants to load a corrupted backup, then the system will print an error message, and the backup will have a 'corrutped_' prefix (so the system renames it), and the graph will remain the same.
Comparison with the Mnesia backend
While the Mnesia backend has been under development longer and can be expected to be more stable, it is much slower than the NIF based backend; you can expect about an order of magnitude of speed-up. Also, the NIF backend may require less storage. As an indication, loading ejabberd-2.1.8 (6.6 MB on disk) takes 18323 sec and 566 MB of RAM and 66 MB of disk space, while the NIF backend on the same machine takes 458 sec and 556 MB of RAM and 52 MB of disk space.