|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the class of keys in the datastoreT
- the class of persistent objects in the datastorepublic interface DataStore<K,T extends Persistent>
DataStore handles actual object persistence. Objects can be persisted,
fetched, queried or deleted by the DataStore methods. DataStores can be
constructed by an instance of DataStoreFactory
.
DataStores implementations should be thread safe.
Note: Results of updates (put(Object, Persistent)
,
delete(Object)
and deleteByQuery(Query)
operations) are
guaranteed to be visible to subsequent get / execute operations ONLY
after a subsequent call to flush()
.
Method Summary | |
---|---|
void |
close()
Close the DataStore. |
void |
createSchema()
Creates the optional schema or table (or similar) in the datastore to hold the objects. |
boolean |
delete(K key)
Deletes the object with the given key |
long |
deleteByQuery(Query<K,T> query)
Deletes all the objects matching the query. |
void |
deleteSchema()
Deletes the underlying schema or table (or similar) in the datastore that holds the objects. |
Result<K,T> |
execute(Query<K,T> query)
Executes the given query and returns the results. |
void |
flush()
Forces the write caches to be flushed. |
T |
get(K key)
Returns the object corresponding to the given key fetching all the fields. |
T |
get(K key,
String[] fields)
Returns the object corresponding to the given key. |
BeanFactory<K,T> |
getBeanFactory()
Returns the BeanFactory used by the DataStore |
org.apache.hadoop.conf.Configuration |
getConf()
|
Class<K> |
getKeyClass()
Returns the class of the keys |
List<PartitionQuery<K,T>> |
getPartitions(Query<K,T> query)
Partitions the given query and returns a list of PartitionQuery s,
which will execute on local data. |
Class<T> |
getPersistentClass()
Returns the class of the persistent objects |
String |
getSchemaName()
Returns the schema name given to this DataStore |
void |
initialize(Class<K> keyClass,
Class<T> persistentClass,
Properties properties)
Initializes this DataStore. |
K |
newKey()
Returns a new instance of the key object. |
T |
newPersistent()
Returns a new instance of the managed persistent object. |
Query<K,T> |
newQuery()
Constructs and returns a new Query. |
void |
put(K key,
T obj)
Inserts the persistent object with the given key. |
void |
readFields(DataInput in)
|
boolean |
schemaExists()
Returns whether the schema that holds the data exists in the datastore. |
void |
setBeanFactory(BeanFactory<K,T> beanFactory)
Sets the BeanFactory to use by the DataStore. |
void |
setConf(org.apache.hadoop.conf.Configuration conf)
|
void |
setKeyClass(Class<K> keyClass)
Sets the class of the keys |
void |
setPersistentClass(Class<T> persistentClass)
Sets the class of the persistent objects |
void |
truncateSchema()
Deletes all the data associated with the schema, but keeps the schema (table or similar) intact. |
void |
write(DataOutput out)
|
Method Detail |
---|
void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws IOException
keyClass
- the class of the keyspersistentClass
- the class of the persistent objectsproperties
- extra metadata
IOException
void setKeyClass(Class<K> keyClass)
keyClass
- the class of keysClass<K> getKeyClass()
void setPersistentClass(Class<T> persistentClass)
persistentClass
- class of persistent objectsClass<T> getPersistentClass()
String getSchemaName()
void createSchema() throws IOException
IOException
void deleteSchema() throws IOException
IOException
void truncateSchema() throws IOException
IOException
boolean schemaExists() throws IOException
IOException
K newKey() throws IOException
IOException
T newPersistent() throws IOException
IOException
T get(K key) throws IOException
key
- the key of the object
IOException
T get(K key, String[] fields) throws IOException
key
- the key of the objectfields
- the fields required in the object. Pass null, to retrieve all fields
IOException
void put(K key, T obj) throws IOException
IOException
boolean delete(K key) throws IOException
key
- the key of the object
IOException
long deleteByQuery(Query<K,T> query) throws IOException
query
- matching records to this query will be deleted
IOException
Result<K,T> execute(Query<K,T> query) throws IOException
query
- the query to execute.
Result
object.
IOException
Query<K,T> newQuery()
List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException
PartitionQuery
s,
which will execute on local data.
query
- the base query to create the partitions for. If the query
is null, then the data store returns the partitions for the default query
(returning every object)
IOException
void flush() throws IOException
IOException
void setBeanFactory(BeanFactory<K,T> beanFactory)
BeanFactory
to use by the DataStore.
beanFactory
- the BeanFactory to useBeanFactory<K,T> getBeanFactory()
void close() throws IOException
close
in interface Closeable
IOException
org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |