#include <Distributor.h>
List of all members.
Detailed Description
A Distributor can be used to Distribute Extents of a Virtual Volume over a number of Disks. This abstract class builds the API of all implemented Distribution Algorithms.
Sascha Effert <fermat@uni-paderborn.de>
Constructor & Destructor Documentation
Distributor::~Distributor |
( |
) |
[virtual] |
Distributor::Distributor |
( |
) |
[protected] |
Member Function Documentation
Distributor * Distributor::createDistributor |
( |
int32_t |
distributor, |
|
|
int |
argc, |
|
|
char ** |
argv |
|
) |
| [static] |
Create a new Distributor of the given kind. Using this factory method a using library has not to know about the implementation classes.
- Parameters:
-
distributor | The kind of distributor |
argc | number of arguments passed to the distributor |
argv | arguments passed to the distributor |
- Returns:
- A new Distributor object
uint64_t Distributor::gcrypt |
( |
std::string * |
data ) |
const |
Creates a Hashvalue using the libgcrypt. The used hash function is specified by gcryptHashAlgorithm.
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash values
uint8_t * Distributor::getBaseMessage |
( |
) |
const [virtual] |
get (a copy of) the BaseMessage used by the Hashfunctions.
Will return a 64-Byte-Array containing a copy of the base-Values used to xor Messages again to create Hashes from. The array belongs to the caller of this method and can be modified and must be deleted by him (using delete[]).
- Returns:
- a copy of the BaseMessage used by the Hashfunctions.
virtual int32_t VDRIVE::Distributor::getCopies |
( |
) |
const [pure virtual] |
virtual std::list<Disk*>* VDRIVE::Distributor::getDisks |
( |
) |
const [pure virtual] |
virtual int64_t VDRIVE::Distributor::getExtentsize |
( |
) |
const [pure virtual] |
uint16_t VDRIVE::Distributor::getNumThreads |
( |
) |
const [inline] |
get the number of Threads that may be used for Initialization (setDisks)
- Returns:
- the number of Threads that may be used for Initialization
double Distributor::hashFunction |
( |
std::string * |
data ) |
const |
This Hashfunction delivers for a given Text a pseudo randomized value between 0 and 1. We used SHA to calculate this value.
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash values
uint64_t Distributor::hashFunctionInt64 |
( |
std::string * |
data ) |
const |
This Hashfunction delivers for a given Text a pseudo randomized int64_t value (can be negative).
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash value
Distributor * Distributor::loadDistributor |
( |
std::string |
filename ) |
[static] |
load a configured Distributor from a file.
- Parameters:
-
filename | The name of the file containing the distributor |
- Returns:
- the Distributor
uint64_t Distributor::myLC |
( |
std::string * |
data ) |
const |
Creates a Hashvalue by using the a linear congruention. Therefore a 64-Bit version of the given message is created which is used as base value. The hash is then computed by
a and b are initialized in the constructor as a = 10000000000000000051 and b = 13.
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash values
uint64_t Distributor::myMTRand |
( |
std::string * |
data ) |
const |
Creates a Hashvalue by using the bit shift operation of Mersenne Twister. Therefore a 32-Bit version of the given message is created which is used as seed. The algorithm computes the first two randomized values which mersenne twister would give us and combines them to a 64 bit randomized value.
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash values
uint64_t Distributor::myRand |
( |
std::string * |
data ) |
const |
Creates a Hashvalue by using the rand-function of stdlib. Therefore a 32-Bit version of the given message is created which is used as seed. The algorithm computes the first two randomized values by using rand() and combines them to a 64 bit randomized value.
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash values
uint64_t Distributor::mySHA1 |
( |
std::string * |
data ) |
const |
Creates a Hashvalue by using SHA1. Therefore a 64-Byte version of the given message is created which is encrypted by SHA1. The first 8 Byte of the Digest are used as result.
- Parameters:
-
data | message to be used as seed |
- Returns:
- a hash values
virtual std::list<Disk*>* VDRIVE::Distributor::placeExtent |
( |
int64_t |
virtualVolumeId, |
|
|
int64_t |
position |
|
) |
| [pure virtual] |
Compute the Disks to be used to place the Extent at position at the given virtualVolumeID. This method has to be implemented by the subclasses of Distributor.
The returned list of Disk object as the Disk objects itself belong the caller of this method. A Distributor creates copy of his Disk objects which are send back in this list. Therefore the caller has to delete the list and the Disk objects in the list if it is no more used.
- Parameters:
-
virtualVolumeId | A ID referencing the virtual volume the Extent belongs to (therefore several virtual Volumes can use the same disks) |
position | The position of the Extent on the virtual Volume |
- Returns:
- The Disks the Extent has to be placed on. All returned Objects have to be deleted by caller of this method.
Implemented in VDRIVE::DistFastRedundantShare, VDRIVE::DistNearestNeighbour, VDRIVE::DistRedundantShare, VDRIVE::DistRoundRobin, VDRIVE::DistRUSHp, and VDRIVE::DistShare.
void Distributor::save |
( |
std::string |
filename ) |
const |
save this (configured) Distributor to a file, so it can be loaded later.
- Parameters:
-
filename | The name of the file the distributor shall be saved in. |
void Distributor::setBaseMessage |
( |
uint8_t * |
baseMessage ) |
[virtual] |
Set the new BaseMessage as described at getBaseMessage. This method will create a copy of this message, so the responsibility for deleting stays at the caller of this method.
- Parameters:
-
baseMessage | The new base Message |
- See also:
- getBaseMessage
Reimplemented in VDRIVE::DistFastRedundantShare, and VDRIVE::DistShare.
virtual void VDRIVE::Distributor::setClusters |
( |
std::list< std::list< Disk * > * > * |
clusters, |
|
|
std::list< uint32_t > * |
weights |
|
) |
| [inline, virtual] |
virtual void VDRIVE::Distributor::setConfiguration |
( |
std::list< Disk * > * |
disks, |
|
|
int64_t |
extentsize, |
|
|
int32_t |
copies |
|
) |
| [pure virtual] |
Set the configuration of the Distributor. This method has to be called exacly once on each Object. It initializes the object, so it can be used to place extents. This method has to be implemented by the subclasses of Distributor.
The list of Disks as the Disk objects itself belong the caller of this method. A Distributor creates copy of the Disk objects. Therefore the caller has to delete the list and the Disk objects in the list if it is no more used.
- Parameters:
-
disks | A list with the description of the Disks to distribute data over. |
extentsize | The size of each extent placed on the disk in bytes. (This can also be in any other scale, but has to be same for capacity of the Disks) |
copies | The number of Disks used to place eache Extent. If a RAID is used upon the Extents this would be the stripe size. |
- Returns:
- A list with the Disks, that shall be used
Implemented in VDRIVE::DistFastRedundantShare, VDRIVE::DistNearestNeighbour, VDRIVE::DistRedundantShare, VDRIVE::DistRoundRobin, VDRIVE::DistRUSHp, and VDRIVE::DistShare.
virtual void VDRIVE::Distributor::setDisks |
( |
std::list< Disk * > * |
disks ) |
[pure virtual] |
void VDRIVE::Distributor::setNumThreads |
( |
uint16_t |
numThreads ) |
[inline] |
set the number of Threads that may be used for Initialization (setDisks)
- Parameters:
-
numThreads | the number of Threads that may be used for Initialization |
virtual xercesc::DOMElement* VDRIVE::Distributor::toXML |
( |
xercesc::DOMDocument * |
doc ) |
const [pure virtual] |
void VDRIVE::Distributor::usedHashAlgorithm |
( |
bool * |
internal, |
|
|
int * |
gcryptalgorithm, |
|
|
int * |
intalgorithm |
|
) |
| const [inline] |
get information about used Hashalgorithm.
- Parameters:
-
internal | true is the internal Hash Algorithm is used, false if a libgcrypt Hash algorithm is used. |
algorithm | only set if internal is false. Then it holds the algorithm used by libgrypt to create Hashes. |
bool VDRIVE::Distributor::useGCryptHashAlgorithm |
( |
int |
algorithm ) |
[inline] |
Use a Hash Algorithm of the lib gcrypt to build hashes.
- Parameters:
-
algorithm | the algorithm to be used. The int represents a hash algorithm which has to exists in the used libgcrypt. For a list of known hash functions have a look at the documentation of your version of libgcrypt. |
void VDRIVE::Distributor::useInternalHashAlgorithm |
( |
int |
algorithm ) |
[inline] |
use the internal Hash Algorithm to create Hashes (SHA1).
Member Data Documentation
used a factor for creation of own Hash using xor. The Hash is build by result = a * message + b The value had to be set in Constructor to use a real big prime number here...
used a sum for creation of own Hash using xor. The Hash is build by result = a * message + b
This value send to createDistributor creates an implementation of CRUSH
if we ose an own Hash function (internalHash is true, so no libgcrypt is used) than this value means we use our MT implementation.
if we ose an own Hash function (internalHash is true, so no libgcrypt is used) than this value means we use our rand implementation.
if we ose an own Hash function (internalHash is true, so no libgcrypt is used) than this value means we use our SHA1 implementation.
if we ose an own Hash function (internalHash is true, so no libgcrypt is used) than this value means we use our linear congruent implementation.
This value send to createDistributor creates an implementation of Nearest Neighbour (Consistant Hashing)
This value send to createDistributor creates an implementation of Redundant Share
This value send to createDistributor creates an implementation of Redundant Share in the O(k) version
This value send to createDistributor creates an implementation of Redundant Share
This value send to createDistributor creates an implementation of RUSHp
This value send to createDistributor creates an implementation of Share
The documentation for this class was generated from the following files: