org.rutil.collection.trie
Interface DataSourceCallback<VALUE_TYPE>

All Known Implementing Classes:
FileDataSourceCallback

public interface DataSourceCallback<VALUE_TYPE>

Author:
mohan

Method Summary
 boolean exists(long key)
          Check if the key exists
 VALUE_TYPE fetch(long key)
          Fetch the value associated with the given key.
 long save(VALUE_TYPE value)
          Saves the given value to the backing datastore and returns a unique key to reference this value.
 

Method Detail

save

long save(VALUE_TYPE value)
Saves the given value to the backing datastore and returns a unique key to reference this value.

Parameters:
value -
Returns:
unique key that maps to the value

fetch

VALUE_TYPE fetch(long key)
                 throws KeyNotFoundException
Fetch the value associated with the given key.

Parameters:
key -
Returns:
value if a mapping exists for the given key or null
Throws:
KeyNotFoundException - if key does not exist.

exists

boolean exists(long key)
Check if the key exists

Parameters:
key -
Returns:
true if the key exists, false otherwise.