Class AddRedundancy
java.lang.Object
net.messagevortex.router.operation.AbstractOperation
net.messagevortex.router.operation.AddRedundancy
- All Implemented Interfaces:
Serializable,Operation
This is the core of the redundancy add operation.
It builds redundant data blocksfrom the existing data blocks.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWrapper for the java random number generator (not normative). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRun()Checks if all prerequisiting fields do exist or can be provided by a subsequent operation.static byte[]execute(byte[] in, int redundancy, int dataStripes, int gf) Execute the add redundancy operation on the provided data.int[]execute(int[] id) Executes the operation and sets at least the provided set of id.int[]Gets all ids which are required to execute this operation.int[]Gets all ids which are written by this operation.static byte[]padds a given payload block.toString()static byte[]Removes padding from a byte array.Methods inherited from class net.messagevortex.router.operation.AbstractOperation
getIdentity, getUsagePeriod, isInUsagePeriod, setInternalPayload, setUsagePeriod
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
-
Constructor Details
-
AddRedundancy
-
-
Method Details
-
canRun
public boolean canRun()Description copied from interface:OperationChecks if all prerequisiting fields do exist or can be provided by a subsequent operation.
- Specified by:
canRunin interfaceOperation- Specified by:
canRunin classAbstractOperation- Returns:
- true if all prerequisits can potentially be satisfied
-
getOutputId
public int[] getOutputId()Description copied from interface:OperationGets all ids which are written by this operation.
- Specified by:
getOutputIdin interfaceOperation- Returns:
- array representing all ids which will be potentially set by this operation
-
getInputId
public int[] getInputId()Description copied from interface:OperationGets all ids which are required to execute this operation.
- Specified by:
getInputIdin interfaceOperation- Returns:
- array representing all ids which will be potentially set by this operation
-
execute
public int[] execute(int[] id) Description copied from interface:OperationExecutes the operation and sets at least the provided set of id.
This operation might trigger to execute prerequisiting operations.
- Specified by:
executein interfaceOperation- Specified by:
executein classAbstractOperation- Parameters:
id- the namespace id to be set minimally- Returns:
- array representing all ids which have been set
-
execute
public static byte[] execute(byte[] in, int redundancy, int dataStripes, int gf) Execute the add redundancy operation on the provided data.
- Parameters:
in- data to add redundancyredundancy- the number of redundancy blocksdataStripes- the number of data stripesgf- the size of the GF- Returns:
- the data with added redundancy
-
pad
public static byte[] pad(int blocksize, int numberOfOutBlocks, byte[] data, Prng prng, int c1, int c2) padds a given payload block.
- Parameters:
blocksize- the size of the blocks of the used encryption in the addRedundancy operationnumberOfOutBlocks- the number of resulting blocks in the addRedundancy operationdata- the data to be padded (payload blockprng- the Prng to be used for paddingc1- the padding parameter c1 as specified in the padding specc2- the padding parameter c2 as specified in the padding spec- Returns:
- the padded data array
-
unpad
public static byte[] unpad(int blocksize, int numberOfOutBlocks, byte[] in, Prng prng) throws IOException Removes padding from a byte array.
- Parameters:
blocksize- encryption block sizenumberOfOutBlocks- number of out streams in the RS functionin- the padded arrayprng- the random number generator for the padding data- Returns:
- the unpadded data stream
- Throws:
IOException- if unpadding fails for any reason
-
toString
-