public class AddRedundancy extends AbstractOperation implements Serializable
This is the core of the redundancy add operation.
It builds redundant data blocksfrom the existing data blocks.
Modifier and Type | Class and Description |
---|---|
static class |
AddRedundancy.SimplePrng
Wrapper for the java random number generator (not normative).
|
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
Constructor and Description |
---|
AddRedundancy(AddRedundancyOperation op) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRun()
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[] |
getInputId()
Gets all ids which are required to execute this operation.
|
int[] |
getOutputId()
Gets all ids which are written by this operation.
|
static byte[] |
pad(int blocksize,
int numberOfOutBlocks,
byte[] data,
Prng prng,
int c1,
int c2)
padds a given payload block.
|
String |
toString() |
static byte[] |
unpad(int blocksize,
int numberOfOutBlocks,
byte[] in,
Prng prng)
Removes padding from a byte array.
|
getIdentity, getUsagePeriod, isInUsagePeriod, setInternalPayload, setUsagePeriod
public static final long serialVersionUID
public AddRedundancy(AddRedundancyOperation op)
public boolean canRun()
Operation
Checks if all prerequisiting fields do exist or can be provided by a subsequent operation.
canRun
in interface Operation
canRun
in class AbstractOperation
public int[] getOutputId()
Operation
Gets all ids which are written by this operation.
getOutputId
in interface Operation
public int[] getInputId()
Operation
Gets all ids which are required to execute this operation.
getInputId
in interface Operation
public int[] execute(int[] id)
Operation
Executes the operation and sets at least the provided set of id.
This operation might trigger to execute prerequisiting operations.
execute
in interface Operation
execute
in class AbstractOperation
id
- the namespace id to be set minimallypublic static byte[] execute(byte[] in, int redundancy, int dataStripes, int gf)
Execute the add redundancy operation on the provided data.
in
- data to add redundancyredundancy
- the number of redundancy blocksdataStripes
- the number of data stripesgf
- the size of the GFpublic static byte[] pad(int blocksize, int numberOfOutBlocks, byte[] data, Prng prng, int c1, int c2)
padds a given payload block.
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 specpublic static byte[] unpad(int blocksize, int numberOfOutBlocks, byte[] in, Prng prng) throws IOException
Removes padding from a byte array.
blocksize
- encryption block sizenumberOfOutBlocks
- number of out streams in the RS functionin
- the padded arrayprng
- the random number generator for the padding dataIOException
- if unpadding fails for any reasonCopyright © 2023. All rights reserved.