com.bigdata.rawstore
Class Addr

java.lang.Object
  extended by com.bigdata.rawstore.Addr

Deprecated. This is now an interface that is extended by 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
extends Object

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).

Version:
$Id: Addr.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

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

NULL

public static final long NULL
Deprecated. 
A null reference (0L).

See Also:
Constant Field Values
Constructor Detail

Addr

public Addr()
Deprecated. 
Method Detail

toLong

public static long toLong(int nbytes,
                          int offset)
Deprecated. 
Converts a length and offset into a long integer.

Parameters:
nbytes - The #of bytes.
offset - The offset.
Returns:
The long integer.

toString

public static String toString(long addr)
Deprecated. 
A human readable representation showing the offset and length components of the address.

Parameters:
addr - An address.
Returns:
The representation.

getByteCount

public static int getByteCount(long addr)
Deprecated. 
Extracts the byte count from a long integer formed by toLong(int, int).

Parameters:
addr - The long integer.
Returns:
The byte count in the corresponding slot allocation.

getOffset

public static int getOffset(long addr)
Deprecated. 
Extracts the offset from a long integer formed by toLong(int, int).

Parameters:
addr - The long integer.
Returns:
The offset.

pack

public static void pack(DataOutput os,
                        long addr)
                 throws IOException
Deprecated. 
Breaks an 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.

Parameters:
os - The output stream.
addr - The Addr.
Throws:
IOException

unpack

public static long unpack(DataInput is)
                   throws IOException
Deprecated. 
Unpacks an Addr.

Parameters:
is - The input stream.
Returns:
The addr.
Throws:
IOException


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.