messif.buckets.split
Interface SplittableAlgorithm.SplittableAlgorithmResult

Enclosing interface:
SplittableAlgorithm

public static interface SplittableAlgorithm.SplittableAlgorithmResult

This is helper class that allows the split method to control the creation of algorithms. When the SplittableAlgorithm.split(messif.buckets.split.SplitPolicy, messif.buckets.split.SplittableAlgorithm.SplittableAlgorithmResult, int) method is called, an instance of this class is provided and the split method should mark all the objects moved through either the markMovedObject(messif.algorithms.Algorithm, messif.objects.LocalAbstractObject) or markMovedObjects(messif.algorithms.Algorithm, java.util.Collection) method.

Example of a split method implementation:

   class SomeAlgorithm extends Algorithm {
       ...
       public void split(SplitPolicy policy, SplittableAlgorithmResult result) throws OccupationLowException, IllegalArgumentException, CapacityFullException {
           Algorithm newAlgorithm = new SomeAlgorithm(...);
           // Move some objects from this algorithm to another one and get the number of bytes or number of objects moved
           for (...moving one object o...) {
               result.markMovedObject(newAlgorithm, o);
           }
           // Or a batch move
           result.markMovedObjects(newAlgorithm, ...collection of objects...);
           ... batch move of collection of objects to algorithm newAlgorithm ...
       }
   }
 


Method Summary
 void markMovedObject(Algorithm algorithm, LocalAbstractObject object)
          Registers a move of one object into the result.
 void markMovedObjects(Algorithm algorithm, java.util.Collection<? extends LocalAbstractObject> objects)
          Registers a move of objects into the result.
 

Method Detail

markMovedObjects

void markMovedObjects(Algorithm algorithm,
                      java.util.Collection<? extends LocalAbstractObject> objects)
                      throws BucketStorageException,
                             java.lang.InstantiationException
Registers a move of objects into the result.

Parameters:
algorithm - the created algorithm that is the destination for the move
objects - the objects moved
Throws:
BucketStorageException - if the move can't be performed due to the capacity or filtering reasons
java.lang.InstantiationException - if encapsulating bucket for the algorithm cannot be created

markMovedObject

void markMovedObject(Algorithm algorithm,
                     LocalAbstractObject object)
                     throws BucketStorageException,
                            java.lang.InstantiationException
Registers a move of one object into the result.

Parameters:
algorithm - the created algorithm that is the destination for the move
object - the object moved
Throws:
BucketStorageException - if the move can't be performed due to the capacity or filtering reasons
java.lang.InstantiationException - if encapsulating bucket for the algorithm cannot be created