Go to the first, previous, next, last section, table of contents.


Managing projects

In this chapter you find how MUIbase organizes projects, how to open, save, delete, and close them, and how swapping works.

File format

A MUIbase project consists of several files stored under its own directory. From Workbench you will not notice the directory structure since double clicking a project icon will not open the directory but start MUIbase loading the project. From CLI however you can see the directory structure of a MUIbase project.

All files of a project are put into one directory which is created by saving a project. Do not remove or place any files or further directories in this directory! They will get lost when reorganizing the project.

The directory contains a file called `Structure.mb' where the descriptions of all tables, attributes, filters, etc. are stored. The record headers are also placed here. For each table you will find a file with the table's name. Here all records of a table are stored. Last but not least there is a file called `.lock'. Do not remove this file. If you did it by accident then simply recreate it, the file contents are not important. This file is used for locking a project, that is, MUIbase first locks this file exclusively and then opens other files. If the locking fails, MUIbase knows that there is already a MUIbase application working on this project. Only one MUIbase application is allowed to work on the same project at a time since record files are opened in read/write mode and we don't want to have mixed data written by two or more applications. ;-)

Info

MUIbase keeps some information about each project. Select menu item `Project - Info' to get information about the current project. The information you get consists of the project's name, the number of tables, the total number of records in all tables, and a value that shows how many bytes a reorganization of this project would gain. The gain is however only a rough estimate and should not be treated as an exact number. Especially if you have made many changes to the structure of the project (adding or removing attributes) then this value is far from accurate.

Clear project

To begin a new project select menu item `Project - Clear - Project'. This clears the current project and MUIbase opens an empty window displaying the MUIbase logo. After starting MUIbase without any projects you are automatically in this mode.

By selecting menu item `Project - Clear - Records' you start a new project using the structure of the current one. This means that everything except the record data of the current project is used for the new project.

If the current project at the time you selected one of the clear menu items has not been saved to disk then a safety requester appears asking for confirmation of the operation.

Open project

MUIbase can handle any number of projects at a time. You are only limited by the size of your available memory. If you want to edit another project, select menu item `Project - Open new'. This opens a new project root window. You can now load a project for this window.

To load a project select menu item `Project - Open - Project'. This opens a file-requester where you can choose a project from. It's also possible to only load the structure of a project, that is, the whole project is loaded except the record data. To do this, select menu item `Project - Open - Structure'.

If you were editing a project at the time of choosing any of the above menu items and the project has not been saved then a safety requester appears asking for confirmation.

Save project

All changes you make to a project are only done in memory. Thus if you want to make them permanent you have to save the project to disk. This is done by choosing menu item `Project - Save'. If your project doesn't have a name yet then a file-requester appears first asking for a filename.

The reason why MUIbase does not automatically save a project when you change it is that this way it is you who decides when to save a project and you can always go back to the last saved version of your project. This mechanism is similar to the `COMMIT' and `ROLLBACK' commands in SQL database systems.

If you save a project, all modified records are written to disk and the file `Structure.mb' is recreated. Before creating the new `Structure.mb' file, MUIbase first renames a possibly existing `Structure.mb' file to `Structure.old' to have a safety copy in case the save operation fails.

This mechanism guarantees fast load & save operations but it is not reorganization free. If you have modified many records then the physical place where the records lie and the resulting fragmentation may become disadvantageous. Therefore a menu item `Project - Save & Reorg' exists that does a save & reorganize operation. This operation may take some time depending on the number and size of the records. The save & reorganize operation creates a new directory and rewrites all project related files. The old directory is deleted on success.

Another good place to execute a reorganization is when you have done changes to the data-structure of a project, e.g. after you have installed a new attribute in a table. These changes are not applied immediately to all records because it would take too much time to load each record, modify it, an save it back to disk. Therefore these changes are put on an internal `todo' list which is applied after loading a record. Applying this list to a record takes only little time. However the longer the list gets the more time it needs. Reorganizing a project causes the `todo' list to be applied to all records, so if you have made many changes to the project structure then reorganizing a project will shorten the time for loading records.

You can also save & reorganize a project to a new filename keeping the old project untouched. To do this select menu item `Project - Save & Reorg As'. MUIbase will prompt you to enter a new name for the project.

Delete project

MUIbase offers a menu item to delete a project. If you select `Project - Delete', enter a filename in the file-requester and confirm the deletion in an additional safety requester then the specified project is deleted from disk.

MUIbase does nothing special here, it simply deletes the directory with all files in it. It is safe to do this in any other way, e.g. by using Workbench or an Amiga Shell.

Close project

If you are done with a project you can close it by selecting menu item `Project - Close'. This removes the project from memory and closes all windows belonging to it. If the project contains changes that have not been saved then a safety requester appears offering to save, continue or cancel the operation.

For closing a project you can also select menu item `Project - Save & Close' which saves the project first if there were any changes and then closes it.

Swap records

MUIbase doesn't need to keep all records of a project in memory. Thus loading and saving of projects is much faster. When loading a project a record header is allocated for each record. The data itself is only loaded when needed, e.g. when it is displayed on the screen. The total number of records is still limited by available memory since each record header needs some few bytes of memory.

You can specify how much memory MUIbase should use for the records of a project. Choose one of the predefined values found in menu item `Preferences - Record memory'. MUIbase will not preallocate a block of the specified memory size, it only checks from time to time if the current size of allocated memory is larger than the specified value. The specified value is not a hard limit, only a suggestion. If MUIbase needs more memory then it will ignore the upper bound and allocate it.

If MUIbase runs out of memory or if the upper limit for the record memory size has been reached then MUIbase tries to free as much record memory as possible. In this case MUIbase may write modified records to disk to get the maximum available memory possible. You can also force MUIbase to do this by choosing menu item `Project - Swap records'.

If there is enough memory to hold all records in memory and you have specified an upper memory limit that is high enough (e.g. `unlimited') then MUIbase never needs to swap out records.

MUIbase maintains a free list for each record file. If you delete a record then the record's file space is added to the free list. Also if you change a record and the record needs to be written to disk then the old file space is added to the free list. However MUIbase makes sure that by reloading you can always go back to the point of the last save operation. MUIbase will not trash areas which are free but where a record still sits that could be reached by reopening the project.


Go to the first, previous, next, last section, table of contents.