public final class Synchronization extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
SIZE |
| Constructor and Description |
|---|
Synchronization() |
| Modifier and Type | Method and Description |
|---|---|
static int |
byteArrayToInt(byte[] b) |
static ArrayList<Checksum> |
decodeChecksumList(byte[] bytes) |
static Number160 |
decodeHash(byte[] bytes) |
static ArrayList<Instruction> |
decodeInstructionList(byte[] bytes) |
static byte[] |
encodeChecksumList(ArrayList<Checksum> checksums) |
static byte[] |
encodeInstructionList(ArrayList<Instruction> instructions,
Number160 number160) |
static ArrayList<Checksum> |
getChecksums(byte[] value,
int blockSize)
It returns an array of weak and strong checksums for the value.
|
static ArrayList<Instruction> |
getInstructions(ArrayList<Instruction> result,
int diff,
int offset,
int a,
int b,
byte[] newValue,
ArrayList<Checksum> checksums,
int blockSize) |
static ArrayList<Instruction> |
getInstructions(byte[] newValue,
ArrayList<Checksum> checksums,
int blockSize)
It returns the sequence of instructions each of which contains either reference to a block or literal data.
|
static byte[] |
getReconstructedValue(byte[] oldValue,
ArrayList<Instruction> instructions,
int blockSize)
It reconstructs the copy of responsible peer's value using instructions and the replica's value.
|
static byte[] |
intToByteArray(int value) |
public static final int SIZE
public static ArrayList<Checksum> getChecksums(byte[] value, int blockSize)
value - The valuesize - The offset sizeNoSuchAlgorithmExceptionpublic static ArrayList<Instruction> getInstructions(byte[] newValue, ArrayList<Checksum> checksums, int blockSize)
newValue - The value at responsible peerchecksums - The array of checksumssize - The offset sizeNoSuchAlgorithmExceptionpublic static ArrayList<Instruction> getInstructions(ArrayList<Instruction> result, int diff, int offset, int a, int b, byte[] newValue, ArrayList<Checksum> checksums, int blockSize)
public static byte[] getReconstructedValue(byte[] oldValue,
ArrayList<Instruction> instructions,
int blockSize)
oldValue - The value at replicainstructions - The sequence of instructionsblockSize - The offset sizepublic static byte[] intToByteArray(int value)
public static int byteArrayToInt(byte[] b)
public static byte[] encodeInstructionList(ArrayList<Instruction> instructions, Number160 number160)
public static ArrayList<Instruction> decodeInstructionList(byte[] bytes)
public static Number160 decodeHash(byte[] bytes)
Copyright © 2014. All rights reserved.