Mercurial > hg > blitz_condensed
diff src/org/dancres/blitz/oid/Allocator.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/dancres/blitz/oid/Allocator.java Sat Mar 21 11:00:06 2009 +0000 @@ -0,0 +1,31 @@ +package org.dancres.blitz.oid; + +import java.io.IOException; + +/** + <p>An Allocator generates a series of UIDImpl's each of which is + guarenteed to be unique within the scope of the Allocator. Note that + allocated id's are not re-used so an Allocator can, potentially, become + exhausted. This can be avoided by allowing the allocator sufficient + space to allocate from by increasing the maximum number of available + allocator ids.</p> + + <p>Allocator's are self-recovering. They check <code>BootContext</code> + for the presence of a <code>SyncBarrier</code> instance which indicates + the maximum number of log operations between checkpoints. This number + represents the maximum number of entry writes or notify registrations which + could have been carried out without the appropriate Allocator instances + being sync'd to disk. Thus, the allocator simply ensures that all it's + oid generators are incremented by the value of the SyncBarrier and sync'd + back to disk. This guarentees that there will be no oid overlap and + means that "user code" need not be involved in the recovery process.</p> + */ +public interface Allocator { + public OID getNextId() throws IOException; + + /** + @return the maximum number of zone id's this Allocator instance + is allowed to use. + */ + public int getMaxZoneId(); +}