public class MigrationRepository extends LayeredRepository
LayeredRepository
for performing migration from top to bottom.
Allows fast read-only access to objects in the bottom; all writes occur only in the top;
a write causes migration of that object.
Users may call migrate(String)
on each handle of the bottom repository to ensure migration.
Bottom objects which have been migrated will be deleted as they are garbage collected; calling cleanUp()
periodically until getTotalReferenceCount()
returns zero will complete that process.Modifier and Type | Class and Description |
---|---|
class |
MigrationRepository.MigrationCallable
Callable suitable for calling in a background thread to perform migration and delete bottom objects.
|
Constructor and Description |
---|
MigrationRepository(Repository top,
Repository bottom)
Constructs a new repository allowing background migration from a bottom repository to a top repository.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
Checks the reference counter queue for objects which may be deleted.
|
void |
closeBottom()
Close the bottom layer and stop using it.
|
int |
getTotalReferenceCount()
Returns the total number of references to bottom digital objects.
|
void |
migrate(java.lang.String handle)
Migrates an object from the bottom repository to the top repository.
|
boolean |
migrationComplete()
Checks whether all objects exist in the top.
|
close, copyDataOrSetAttributeForMissing, copyForLayeredRepo, createDataElement, createDigitalObject, deleteAttribute, deleteAttributes, deleteDataElement, deleteDigitalObject, getAttribute, getAttributes, getBottom, getDigitalObject, getFile, getSize, getTop, lift, listAttributes, listDataElementNames, listHandles, read, search, searchHandles, setAttribute, setAttributes, verifyDataElement, verifyDigitalObject, write
getHandle, getOrCreateDigitalObject, listObjects, search, search, searchHandles, searchHandles, searchMapping
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getHandle, getOrCreateDigitalObject, listObjects, search, search, searchHandles, searchHandles, searchMapping
public MigrationRepository(Repository top, Repository bottom) throws RepositoryException
top
- The top repository, to be migrated to.bottom
- The bottom repository, to be migrated from and made empty.RepositoryException
public void migrate(java.lang.String handle) throws RepositoryException, java.io.IOException
handle
- The handle of the object in the bottom repository.RepositoryException
java.io.IOException
public void cleanUp()
public int getTotalReferenceCount()
public boolean migrationComplete()
public void closeBottom()
getTotalReferenceCount()
returns 0.