com.bigdata.rawstore
Interface IAddressManager

All Known Subinterfaces:
IAtomicStore, IBufferStrategy, IDiskBasedStrategy, IJournal, IRawStore, IUpdateStore
All Known Implementing Classes:
AbstractBufferStrategy, AbstractJournal, AbstractRawStore, AbstractRawWormStore, BasicBufferStrategy, BufferedDiskStrategy, DirectBufferStrategy, DiskBackedBufferStrategy, DiskOnlyStrategy, IndexSegmentAddressManager, IndexSegmentStore, Journal, MappedBufferStrategy, SimpleMemoryRawStore, StoreManager.ManagedJournal, TemporaryRawStore, TemporaryStore, TransientBufferStrategy, WormAddressManager

public interface IAddressManager

An interface that encapsulates operations on opaque identifiers used to locate data within an IRawStore.

Version:
$Id: IAddressManager.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
TODO:
consider address segments to support fast combination of buffers each containing its own address space. A prime candidate for this is the IndexSegmentBuilder which currently jumps through hoops in order to make the nodes resolvable. When considering segments, note that addresses may currently be directly tested for order since the offset is in the high int32 word.

Field Summary
static long NULL
          A null reference (0L).
 
Method Summary
 int getByteCount(long addr)
          The length of the datum in bytes.
 long getOffset(long addr)
          The offset on the store at which the datum is stored.
 void packAddr(DataOutput out, long addr)
          Pack the address onto the output stream.
 long toAddr(int nbytes, long offset)
          Converts a byte count and offset into a long integer.
 String toString(long addr)
          A human readable representation of the address.
 long unpackAddr(DataInput in)
          Unpack the address from the input stream.
 

Field Detail

NULL

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

Note: It is a requirement that all implementations understand the value 0L as a null reference.

See Also:
Constant Field Values
Method Detail

toAddr

long toAddr(int nbytes,
            long offset)
Converts a byte count and offset into a long integer.

Parameters:
nbytes - The byte count.
offset - The byte offset.
Returns:
The long integer.
Throws:
IllegalArgumentException - if the byte count is larger than can be represented by the address manager.
IllegalArgumentException - if the byte offset is larger than can be represented by the address manager.

getOffset

long getOffset(long addr)
The offset on the store at which the datum is stored. While this is often the offset of a byte into a file on disk, implementations MAY assign offsets using other strategies.

Parameters:
addr - The opaque identifier that is the within store locator for some datum.
Returns:
The offset of that datum.

getByteCount

int getByteCount(long addr)
The length of the datum in bytes.

Parameters:
addr - The opaque identifier that is the within store locator for some datum.
Returns:
The offset of that datum.

packAddr

void packAddr(DataOutput out,
              long addr)
              throws IOException
Pack the address onto the output stream.

Parameters:
out - The output stream.
addr - The opaque identifier that is the within store locator for some datum.
Throws:
IOException

unpackAddr

long unpackAddr(DataInput in)
                throws IOException
Unpack the address from the input stream.

Parameters:
in - The input stream.
Returns:
The opaque identifier that is the within store locator for some datum.
Throws:
IOException

toString

String toString(long addr)
A human readable representation of the address.

Parameters:
addr - The opaque identifier that is the within store locator for some datum.
Returns:
A human readable representation.


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