org.apache.hadoop.hbase.io.hfile
Interface Cacheable

All Superinterfaces:
HeapSize
All Known Implementing Classes:
HFileBlock

@InterfaceAudience.Private
public interface Cacheable
extends HeapSize

Cacheable is an interface that allows for an object to be cached. If using an on heap cache, just use heapsize. If using an off heap cache, Cacheable provides methods for serialization of the object. Some objects cannot be moved off heap, those objects will return a getSerializedLength() of 0.


Method Summary
 BlockType getBlockType()
           
 CacheableDeserializer<Cacheable> getDeserializer()
          Returns CacheableDeserializer instance which reconstructs original object from ByteBuffer.
 int getSerializedLength()
          Returns the length of the ByteBuffer required to serialized the object.
 void serialize(ByteBuffer destination)
          Serializes its data into destination.
 
Methods inherited from interface org.apache.hadoop.hbase.io.HeapSize
heapSize
 

Method Detail

getSerializedLength

int getSerializedLength()
Returns the length of the ByteBuffer required to serialized the object. If the object cannot be serialized, it should also return 0.

Returns:
int length in bytes of the serialized form.

serialize

void serialize(ByteBuffer destination)
Serializes its data into destination.


getDeserializer

CacheableDeserializer<Cacheable> getDeserializer()
Returns CacheableDeserializer instance which reconstructs original object from ByteBuffer.

Returns:
CacheableDeserialzer instance.

getBlockType

BlockType getBlockType()
Returns:
the block type of this cached HFile block


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.