Claims a free segment. Priority is first to use segments already in the disposed list from to_be_recycled. Next is to use a element in the recycler indices. Therefore removing a segment from the recycler. Secondly if no available segments then it appends a new segment to the blockfile and changes the owners last block index.
Disposes a used segment. This means adding a NEW segment to the recycler.
Dumps the segments in the recycler.
Dumps the segments in the to_be_recycled array.
Insert a single segment into the recycler.
Inserts a range of segments into the recycler.
Reads an element from the blockfile.
Recycles the segments. Goes over the list of recycle_segments. First it takes the lowerbound. If there is a element in the lowerbound, the index of the current segment is changed to the one of the lowerbound.back and the lower_range.back is removed. The same step is used for the upperbound using the front of the elements. We go over all the new segments that needs to be recycled. First we get lowerBound in the indices. The indices are sorted by index meaning we get all sgements by indices as a range that are smaller or equal to our segment. If the segments connext we add remove it and create a new one. The same procedure is used for the upperrange.
Removes a segment from the recycler.
Function to sort the segments by their size. It returns a assumeSorted of the segments.
Writes the data to the file. First it calls recycler with the to_be_recycled. Afterwards it goes through and updates the pointer chain.
Indices that are stored in the blockfile.
* Checks if the indices and segments are the same length; *//// The blockfile owne
The other way to sort. Sorted by segment size therefore allowing overlaps.
RecycleSegments that are disposed and need to be added to the recycler.
Used for disposing and claiming segments from the blockfile. Therefore responsible for keeping track of unused segments. and making sure these are used so the file does not continue. growing.