|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rawstore.Addr
IRawStore
such that each store may be provisioned for a different split
between the bits dedicated to the offset and the bits dedicated
to the length of the data record. Only toLong(int, int),
getOffset(long), and getByteCount(long) will
need to become instance methods. The metadata required to recover
the provisioned bit split must be stored in the root block of a
persistence store so that it may be recovered without record to
decoding an Addr. (This is also going to cause a lot of
javadoc comments to refer to the "Addr" interface, which will be
the base interface for IRawStore and that will be
confusing and should be cleaned up.)
Other consequences are that offset and nextOffset are always long
integers and that packing and unpacking of addresses requires
knowledge of the #offset bits (so SerializerUtil should
not be used for those cases). This change to serialization also
effects how btree nodes and leaves are stored.
public final class Addr
An address encodes both an int32 length and an int32 offset into a single long integer. This limits the addressable size of a file to int32 bytes (actually, only 2^31 bytes, e.g., 2G, since Java is using signed integers), but that limit far exceeds the envisoned capacity of a single file in the bigdata architecture. Note that the long integer ZERO (0L) is reserved and always has the semantics of a null reference. Writes at offset zero are allowed, depending on the store, by writes of zero length are disallowed and hence no address will ever be ZERO (0L).
| Field Summary | |
|---|---|
static long |
NULL
Deprecated. A null reference (0L). |
| Constructor Summary | |
|---|---|
Addr()
Deprecated. |
|
| Method Summary | |
|---|---|
static int |
getByteCount(long addr)
Deprecated. Extracts the byte count from a long integer formed by toLong(int, int). |
static int |
getOffset(long addr)
Deprecated. Extracts the offset from a long integer formed by toLong(int, int). |
static void |
pack(DataOutput os,
long addr)
Deprecated. Breaks an Addr into its offset and size and packs each component
separately. |
static long |
toLong(int nbytes,
int offset)
Deprecated. Converts a length and offset into a long integer. |
static String |
toString(long addr)
Deprecated. A human readable representation showing the offset and length components of the address. |
static long |
unpack(DataInput is)
Deprecated. Unpacks an Addr. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long NULL
| Constructor Detail |
|---|
public Addr()
| Method Detail |
|---|
public static long toLong(int nbytes,
int offset)
nbytes - The #of bytes.offset - The offset.
public static String toString(long addr)
addr - An address.
public static int getByteCount(long addr)
toLong(int, int).
addr - The long integer.
public static int getOffset(long addr)
toLong(int, int).
addr - The long integer.
public static void pack(DataOutput os,
long addr)
throws IOException
Addr into its offset and size and packs each component
separately. This provides much better packing then packing the entire
Addr as a long integer since each component tends to be a small
positive integer value.
os - The output stream.addr - The Addr.
IOException
public static long unpack(DataInput is)
throws IOException
Addr.
is - The input stream.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||