public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T>
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_MAPPING_FILE |
protected static String |
INSTANCE_NAME_PROPERTY |
static org.slf4j.Logger |
LOG |
protected static String |
MOCK_PROPERTY |
protected static String |
PASSWORD_PROPERTY |
protected static String |
USERNAME_PROPERTY |
protected static String |
ZOOKEEPERS_NAME_PROPERTY |
autoCreateSchema, beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, persistentClass, properties, schema
Constructor and Description |
---|
AccumuloStore() |
Modifier and Type | Method and Description |
---|---|
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.
|
K |
fromBytes(Class<K> clazz,
byte[] val) |
static <K> K |
fromBytes(Encoder encoder,
Class<K> clazz,
byte[] val) |
static Object |
fromBytes(Encoder encoder,
org.apache.avro.Schema schema,
byte[] data) |
Object |
fromBytes(org.apache.avro.Schema schema,
byte[] data) |
T |
get(K key,
String[] fields)
Returns the object corresponding to the given key.
|
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. |
String |
getSchemaName()
Returns the schema name given to this DataStore
|
void |
initialize(Class<K> keyClass,
Class<T> persistentClass,
Properties properties)
Initializes this DataStore.
|
Query<K,T> |
newQuery()
Constructs and returns a new Query.
|
org.apache.accumulo.core.data.ByteSequence |
populate(Iterator<Map.Entry<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Value>> iter,
T persistent) |
void |
put(K key,
T val)
Inserts the persistent object with the given key.
|
protected AccumuloMapping |
readMapping(String filename) |
boolean |
schemaExists()
Returns whether the schema that holds the data exists in the datastore.
|
static byte[] |
toBytes(Encoder encoder,
Object o) |
byte[] |
toBytes(Object o) |
byte[] |
toBytes(org.apache.avro.Schema toSchema,
Object o) |
equals, get, getBeanFactory, getConf, getFields, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, readFields, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema, write
protected static final String MOCK_PROPERTY
protected static final String INSTANCE_NAME_PROPERTY
protected static final String ZOOKEEPERS_NAME_PROPERTY
protected static final String USERNAME_PROPERTY
protected static final String PASSWORD_PROPERTY
protected static final String DEFAULT_MAPPING_FILE
public static final org.slf4j.Logger LOG
public Object fromBytes(org.apache.avro.Schema schema, byte[] data) throws GoraException
GoraException
public static Object fromBytes(Encoder encoder, org.apache.avro.Schema schema, byte[] data)
public byte[] toBytes(org.apache.avro.Schema toSchema, Object o)
public byte[] toBytes(Object o)
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
DataStore
initialize
in interface DataStore<K,T extends PersistentBase>
initialize
in class DataStoreBase<K,T extends PersistentBase>
keyClass
- the class of the keyspersistentClass
- the class of the persistent objectsproperties
- extra metadataprotected AccumuloMapping readMapping(String filename) throws IOException
IOException
public String getSchemaName()
DataStore
public void createSchema()
DataStore
public void deleteSchema()
DataStore
public boolean schemaExists()
DataStore
public org.apache.accumulo.core.data.ByteSequence populate(Iterator<Map.Entry<org.apache.accumulo.core.data.Key,org.apache.accumulo.core.data.Value>> iter, T persistent) throws IOException
IOException
public T get(K key, String[] fields)
DataStore
key
- the key of the objectfields
- the fields required in the object. Pass null, to retrieve all fieldspublic void put(K key, T val)
DataStore
public boolean delete(K key)
DataStore
key
- the key of the objectpublic long deleteByQuery(Query<K,T> query)
DataStore
query
- matching records to this query will be deletedpublic Result<K,T> execute(Query<K,T> query)
DataStore
query
- the query to execute.Result
object.public Query<K,T> newQuery()
DataStore
public List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException
DataStore
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
public void flush()
DataStore
public void close()
DataStore
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.