Version 2 (modified by manualwiki, 13 years ago) (diff) |
---|
Using the NIF database back-end
Currently, the Mnesia based back-end is the default, therefore you have to specify a command line argument if you would like to use the NIF based back-end.
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 is started, the following operations work on the full database.
% Clear the whole database. ri:reset(). % Make a checkpoint. % This operation is always executed after transformations % and file operations (e.g. adding or dropping a file). ri:backup(). % After that the output will be {ok, backup.1} % This backup will be created in the directory of the graph. % Make a checkpoint with a commit log message. ri:backup("Something log message"). % It will print the following: {ok, backup.2} % That backup.2 will be created in the same directory as backup.1. % Now we want to know some informations about backup.2. % Note: Here you can specify either 'backup.2' or "backup.2" or just 2. ri:backup_info(2). Informations about 'backup.2': Commit-log: Something log message Time of creation: Tue Apr 17 11:03:29 2012 % Lists all backups. ri:ls_backups(). % Undo all changes made since the last backup. ri:undo(). % Removes all backups. ri:clean().
You can also use all querying and refactoring functionalities.
Comparison with the Mnesia back-end
While the Mnesia back-end has been under development longer and can be expected to be more stable, it is much slower than the NIF based back-end; you can expect about an order of magnitude of speed-up. Also, the NIF back-end 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 back-end on the same machine takes 458 sec and 556 MB of RAM and 52 MB of disk space.