UP TO HOW IT WORKS

RETOUR A COMMENT CELA MARCHE

JOAFIP heap file management

append of a first data record to store an object state

Initialy the heap file has:

The heap header has a "next id" field. The "next id" field contains the next usable data record identifier value.
When a new data record is added it has the "next id" value as identifier, then the "next id" is incremented by 1.
The heap file size is increased to store the data record.

initial file state

final file state

heap

heap

append of a second data record to store an object state

Since there is no free area in the file a new data record is added.
The nes data record identifier has the "next id" value as identifier, then the "next id" is incremented by 1.
The heap file size is increased to store the data record.

initial file state

final file state

heap

heap

append of a third data record to store an object state

Since there is no free area in the file a new data record is added.
The nes data record identifier has the "next id" value as identifier, then the "next id" is incremented by 1.
The heap file size is increased to store the data record.

initial file state

final file state

heap

heap

Delete the data record #3

A free area replace the previous data record.
The heap file size keep unchanged.

initial file state

final file state

heap

heap

Delete the data record #2

A free area replace the previous data record merging with adjacent free area
The heap file size keep unchanged.

initial file state

final file state

heap

heap

append of a fourth data record to store an object state

Current next identifier value is used for new data record, then current next identifier value is incremented by 1
The heap file size keep unchanged since free area is large enough to contains new data record.
The free area is reduce to its previous size minus the new data record size.

initial file state

final file state

heap

heap



© 2007-2011, joafip