voldemort.store.readonly.chunk
Class ChunkedFileSet

java.lang.Object
  extended by voldemort.store.readonly.chunk.ChunkedFileSet

public class ChunkedFileSet
extends java.lang.Object

A set of chunked data and index files for a read-only store


Nested Class Summary
static class ChunkedFileSet.ROCollidedEntriesIterator
          Iterator over top 8 bytes of md5(key) and all collided entries ( including the number of entries ) Works only for ReadOnlyStorageFormat.READONLY_V2
static class ChunkedFileSet.ROEntriesIterator
          Iterator for RO entries - Works only for ReadOnlyStorageFormat.READONLY_V2
static class ChunkedFileSet.ROKeyIterator
          Iterator for RO keys - Works only for ReadOnlyStorageFormat.READONLY_V2
 
Constructor Summary
ChunkedFileSet(java.io.File directory, RoutingStrategy routingStrategy, int nodeId)
           
ChunkedFileSet(java.io.File directory, RoutingStrategy routingStrategy, int nodeId, boolean enforceMlock)
           
 
Method Summary
 void close()
           
 java.nio.channels.FileChannel dataFileFor(int chunk)
           
 int getChunkForKey(byte[] key)
          Given a particular key, first converts its to the storage format and then determines which chunk it belongs to
 java.util.HashMap<java.lang.Object,java.lang.Integer> getChunkIdToNumChunks()
          Get the chunk id to num chunks mapping
 int getDataFileSize(int chunk)
           
 int getIndexFileSize(int chunk)
           
 int getNumChunks()
           
 ReadOnlyStorageFormat getReadOnlyStorageFormat()
           
 java.nio.ByteBuffer indexFileFor(int chunk)
           
 void initVersion0()
           
 void initVersion1()
           
 void initVersion2()
           
 byte[] keyToStorageFormat(byte[] key)
          Converts the key to the format in which it is stored for searching
 byte[] readValue(byte[] key, int chunk, int valueLocation)
           
 DataFileChunkSet toDataFileChunkSet()
           
 void validateFileSizes(long indexLength, long dataLength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkedFileSet

public ChunkedFileSet(java.io.File directory,
                      RoutingStrategy routingStrategy,
                      int nodeId,
                      boolean enforceMlock)

ChunkedFileSet

public ChunkedFileSet(java.io.File directory,
                      RoutingStrategy routingStrategy,
                      int nodeId)
Method Detail

toDataFileChunkSet

public DataFileChunkSet toDataFileChunkSet()

getReadOnlyStorageFormat

public ReadOnlyStorageFormat getReadOnlyStorageFormat()

initVersion0

public void initVersion0()

initVersion1

public void initVersion1()

initVersion2

public void initVersion2()

getChunkIdToNumChunks

public java.util.HashMap<java.lang.Object,java.lang.Integer> getChunkIdToNumChunks()
Get the chunk id to num chunks mapping

Returns:
Map of chunk id to number of chunks

validateFileSizes

public void validateFileSizes(long indexLength,
                              long dataLength)

close

public void close()

getNumChunks

public int getNumChunks()

keyToStorageFormat

public byte[] keyToStorageFormat(byte[] key)
Converts the key to the format in which it is stored for searching

Parameters:
key - Byte array of the key
Returns:
The format stored in the index file

getChunkForKey

public int getChunkForKey(byte[] key)
Given a particular key, first converts its to the storage format and then determines which chunk it belongs to

Parameters:
key - Byte array of keys
Returns:
Chunk id

readValue

public byte[] readValue(byte[] key,
                        int chunk,
                        int valueLocation)

indexFileFor

public java.nio.ByteBuffer indexFileFor(int chunk)

dataFileFor

public java.nio.channels.FileChannel dataFileFor(int chunk)

getIndexFileSize

public int getIndexFileSize(int chunk)

getDataFileSize

public int getDataFileSize(int chunk)


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu