version 1.1, 2002/02/15 00:03:59
|
version 1.2, 2002/02/15 00:13:30
|
|
|
| |
<h1>Synopsis</h1> |
/** Instance Repository |
| |
This file describes the algorithms and architecture of the instances |
<h1>Synopsis</h1> |
repository (that part of the repository which deals with instances). |
Describes the algorithms and architecture of the instances repository |
|
(that part of the repository which deals with instances). |
| |
<h1>Layout</h1> | <h1>Layout</h1> |
| |
All files belonging the instance repository are stored under the |
All files belonging to the instance repository are stored under the |
repository/instances directory. For each class two files are maintained: | repository/instances directory. For each class two files are maintained: |
and index file (with a ".idx" extension) and an instance file which bears | and index file (with a ".idx" extension) and an instance file which bears |
the name of the class whose instances it contains. For example, suppose | the name of the class whose instances it contains. For example, suppose |
there is a class called "Zebra". Then two files are used to managed |
there is a class called "Zebra". Then two files are used to manage its |
its instances: |
instances: |
| |
<pre> | <pre> |
repository/instances/Zerbra.idx (called the index file) |
repository/instances/Zebra.idx (called the index file) |
repository/instances/Zerbra (called the instance file) |
repository/instances/Zebra (called the instance file) |
</pre> | </pre> |
| |
The first line of the index file indicates how many instances have been | The first line of the index file indicates how many instances have been |
|
|
</pre> | </pre> |
| |
First notice that the dirty count is equal to two and that two entries are | First notice that the dirty count is equal to two and that two entries are |
marked as deleted (these quantities will always be equal). This indicates |
marked as deleted (these quantities must be equal). This indicates that the |
that the instance file has two instances which are no longer used. The space |
instance file has two instances which are no longer used. The space used by |
used by these instances will be reclaimed during reorganization. |
these instances will be reclaimed during reorganization. |
| |
The layout of the instance file is trivial. Instances are always appended to | The layout of the instance file is trivial. Instances are always appended to |
to the instance file. The instances are kept end-to-end in the file. | to the instance file. The instances are kept end-to-end in the file. |
|
|
<h1>Reorganization</h1> | <h1>Reorganization</h1> |
| |
To improve performance, reclamation of unused space in the instance file | To improve performance, reclamation of unused space in the instance file |
(called gaps) is postponed until there are N gaps. Deletion and modification |
(called gaps) is postponed until there are m gaps. Deletion and modification |
operations create gaps. A dirty-count is maintained in the index file as | operations create gaps. A dirty-count is maintained in the index file as |
described above. When this dirty count reaches N, available space is reclaimed. |
described above. When this dirty count reaches m, available space is reclaimed. |
Reorganization is expensive: the entire file must be rewritten. The time | Reorganization is expensive: the entire file must be rewritten. The time |
complexity is O(n) where n is the number of instances in the file. By | complexity is O(n) where n is the number of instances in the file. By |
postponing reorganization, the time complexity may be reduced to O(1). | postponing reorganization, the time complexity may be reduced to O(1). |
|
|
| |
</ul> | </ul> |
| |
|
*/ |