ostore.archive
Class VHashTreeNativeIF
java.lang.Object
|
+--ostore.archive.VHashTreeNativeIF
- public class VHashTreeNativeIF
- extends Object
VHashTreeNativeIF
is an interface
to a
native
C
implementation of the
VerificationTree
.
VerificationTree
is computed as a
tree (right now, binary) of hashes, where a parent
node is the hash over the concatenation of its children.
- Version:
- $Id: VHashTreeNativeIF.java,v 1.2 2003/11/17 23:52:43 emilong Exp $
- Author:
- Hakim Weatherspoon
Field Summary |
static boolean |
available
available indicates if the C implementation
of VHashTree is available. |
Method Summary |
static long |
calculateHashes(byte[] block,
int blockOffset,
int blockLength,
byte[] fragHeaderArray,
int fragHeaderOffset,
int fragHeaderLength,
int[] intFrags,
int intFragOffset,
int intFragLength,
int numFragments,
byte[] hashes,
int hashesOffset,
int hashesLength)
calculateHashes calculates the verification tree for
the input block and fragments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
available
public static boolean available
available
indicates if the C
implementation
of VHashTree
is available.
VHashTreeNativeIF
public VHashTreeNativeIF()
calculateHashes
public static long calculateHashes(byte[] block,
int blockOffset,
int blockLength,
byte[] fragHeaderArray,
int fragHeaderOffset,
int fragHeaderLength,
int[] intFrags,
int intFragOffset,
int intFragLength,
int numFragments,
byte[] hashes,
int hashesOffset,
int hashesLength)
calculateHashes
calculates the verification tree for
the input block and fragments.
- Parameters:
block
- block
that was
encoded
{in
serialized
byte form}.blockOffset
- Offset into block array where the
block
array
"actually" starts.blockLength
- Length of block array.fragHeaderArray
- Byte array the header that will be appended
to all fragments. The size is
Fragment.OVERHEAD
-
Erasure.sizeOfLong
. We subtract the
Erasure.sizeOfLong
because the
fragment
index
is included in the
fragment
data
array.fragHeaderOffset
- Offset into fragHeaderArray where the array
"actually" starts.fragHeaderLength
- Length of fragHeaderArray.intFrags
- All fragments
in
a single int
array form.
The beginning of each
fragment
includes the
fragment
index
.intFragOffset
- Offset into intFrags array where the
fragments
array
"actually" starts.intFragLength
- Length of intFrags array.numFragments
- Number of
fragments
.hashes
- VerificationTree
in array form. n
is the number
of fragment
.
The first hashes at hash index
0 .. n-1
are hashes of the
fragment
themselves. Hashes at index
n .. 2n-2
are parent
hashes. Hash at index 2n-1
is the fragment hash (top verification
hash over just the fragments). Finally,
hash 2n
is the GUID.hashesOffset
- Offset int hashes array where the hash array
"actually" starts.hashesLength
- Length of hashes array.
- Returns:
- return == time in milleseconds to calculate
VerificationTree
.