public class MemStore<K,T extends PersistentBase> extends DataStoreBase<K,T>
DataStore
implementation for tests.Modifier and Type | Class and Description |
---|---|
static class |
MemStore.MemQuery<K,T extends PersistentBase> |
static class |
MemStore.MemResult<K,T extends PersistentBase> |
Modifier and Type | Field and Description |
---|---|
static ConcurrentSkipListMap |
map |
autoCreateSchema, beanFactory, conf, datumReader, datumWriter, fieldMap, keyClass, persistentClass, properties, schema
Constructor and Description |
---|
MemStore() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the DataStore.
|
void |
createSchema()
As MemStore is basically an implementation of
ConcurrentSkipListMap
it has no concept of a schema. |
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)
An important feature of
execute(Query) is
that when specifying the MemStore.MemQuery one should be aware
that when fromKey and toKey are equal, the returned map is empty
unless fromInclusive and toInclusive are both true. |
void |
flush()
Forces the write caches to be flushed.
|
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
|
Query<K,T> |
newQuery()
Constructs and returns a new Query.
|
void |
put(K key,
T obj)
Inserts the persistent object with the given key.
|
boolean |
schemaExists()
Returns whether the schema that holds the data exists in the datastore.
|
equals, get, getBeanFactory, getConf, getFields, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, initialize, newKey, newPersistent, readFields, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema, write
public static ConcurrentSkipListMap map
public String getSchemaName()
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)
execute(Query)
is
that when specifying the MemStore.MemQuery
one should be aware
that when fromKey and toKey are equal, the returned map is empty
unless fromInclusive and toInclusive are both true. On the other hand
if either or both of fromKey and toKey are null we return no results.query
- the query to execute.Result
object.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 Query<K,T> newQuery()
DataStore
public void put(K key, T obj)
DataStore
public List<PartitionQuery<K,T>> getPartitions(Query<K,T> query)
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)public void close()
DataStore
public void createSchema()
ConcurrentSkipListMap
it has no concept of a schema.public void deleteSchema()
DataStore
public boolean schemaExists()
DataStore
public void flush()
DataStore
Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.