org.fusesource.hawtdb.api
Interface Allocator


public interface Allocator

Handles allocation management of resources. Used for page allocations in a Paged resource.

Author:
Hiram Chirino

Method Summary
 int alloc(int count)
          Allocates a continuous number of items and returns the position of first item in the sequence.
 void clear()
          Frees all previous allocations.
 void free(int firstPage, int count)
          Frees a given number of items at a given position.
 org.fusesource.hawtdb.internal.util.Ranges getFreeRanges()
           
 int getLimit()
           
 boolean isAllocated(int page)
           
 void setFreeRanges(org.fusesource.hawtdb.internal.util.Ranges freeList)
           
 void unfree(int firstPage, int count)
          Undoes a previous free method call.
 

Method Detail

alloc

int alloc(int count)
          throws OutOfSpaceException
Allocates a continuous number of items and returns the position of first item in the sequence.

Throws:
OutOfSpaceException

free

void free(int firstPage,
          int count)
Frees a given number of items at a given position.


unfree

void unfree(int firstPage,
            int count)
            throws java.lang.UnsupportedOperationException
Undoes a previous free method call. optional method. implementations my throw UnsupportedOperationException

Throws:
java.lang.UnsupportedOperationException - may be thrown by some allocators.

clear

void clear()
           throws java.lang.UnsupportedOperationException
Frees all previous allocations. optional method. implementations my throw UnsupportedOperationException

Throws:
java.lang.UnsupportedOperationException

getLimit

int getLimit()
Returns:
the maximum number of pages that this allocator will allocate.

isAllocated

boolean isAllocated(int page)
Parameters:
page -
Returns:
true if the page has been allocated.

setFreeRanges

void setFreeRanges(org.fusesource.hawtdb.internal.util.Ranges freeList)

getFreeRanges

org.fusesource.hawtdb.internal.util.Ranges getFreeRanges()


Copyright © 2009-2011 FuseSource, Corp.. All Rights Reserved.