comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.oid;
2
3 import java.io.IOException;
4
5 /**
6 <p>An Allocator generates a series of UIDImpl's each of which is
7 guarenteed to be unique within the scope of the Allocator. Note that
8 allocated id's are not re-used so an Allocator can, potentially, become
9 exhausted. This can be avoided by allowing the allocator sufficient
10 space to allocate from by increasing the maximum number of available
11 allocator ids.</p>
12
13 <p>Allocator's are self-recovering. They check <code>BootContext</code>
14 for the presence of a <code>SyncBarrier</code> instance which indicates
15 the maximum number of log operations between checkpoints. This number
16 represents the maximum number of entry writes or notify registrations which
17 could have been carried out without the appropriate Allocator instances
18 being sync'd to disk. Thus, the allocator simply ensures that all it's
19 oid generators are incremented by the value of the SyncBarrier and sync'd
20 back to disk. This guarentees that there will be no oid overlap and
21 means that "user code" need not be involved in the recovery process.</p>
22 */
23 public interface Allocator {
24 public OID getNextId() throws IOException;
25
26 /**
27 @return the maximum number of zone id's this Allocator instance
28 is allowed to use.
29 */
30 public int getMaxZoneId();
31 }