|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.gora.store.impl.DataStoreBase<K,T>
org.apache.gora.store.impl.FileBackedDataStoreBase<K,T>
org.apache.gora.avro.store.AvroStore<K,T>
T
- public class AvroStore<K,T extends Persistent>
An adapter DataStore for binary-compatible Avro serializations. AvroDataStore supports Binary and JSON serializations.
Nested Class Summary | |
---|---|
static class |
AvroStore.CodecType
The type of the avro Encoder/Decoder. |
Field Summary | |
---|---|
static String |
CODEC_TYPE_KEY
The property key specifying avro encoder/decoder type to use. |
Fields inherited from class org.apache.gora.store.impl.FileBackedDataStoreBase |
---|
inputPath, inputSize, inputStream, outputPath, outputStream |
Fields inherited from class org.apache.gora.store.impl.DataStoreBase |
---|
autoCreateSchema, beanFactory, conf, fieldMap, keyClass, persistentClass, properties, schema |
Constructor Summary | |
---|---|
AvroStore()
|
Method Summary | |
---|---|
void |
close()
Close the DataStore. |
protected org.apache.avro.io.DatumReader<T> |
createDatumReader()
|
protected org.apache.avro.io.DatumWriter<T> |
createDatumWriter()
|
protected org.apache.avro.io.Decoder |
createDecoder()
|
protected org.apache.avro.io.Encoder |
createEncoder()
|
boolean |
delete(K key)
Deletes the object with the given key |
long |
deleteByQuery(Query<K,T> query)
Deletes all the objects matching the query. |
protected Result<K,T> |
executePartial(FileSplitPartitionQuery<K,T> query)
Executes a PartitialQuery, reading the data between start and end. |
protected Result<K,T> |
executeQuery(Query<K,T> query)
Executes a normal Query reading the whole data. |
void |
flush()
Forces the write caches to be flushed. |
T |
get(K key,
String[] fields)
Returns the object corresponding to the given key. |
org.apache.hadoop.conf.Configuration |
getConf()
|
org.apache.avro.io.DatumReader<T> |
getDatumReader()
|
org.apache.avro.io.DatumWriter<T> |
getDatumWriter()
|
org.apache.avro.io.Decoder |
getDecoder()
|
org.apache.avro.io.Encoder |
getEncoder()
|
String |
getSchemaName()
Returns the schema name given to this DataStore |
void |
initialize(Class<K> keyClass,
Class<T> persistentClass,
Properties properties)
Initializes this DataStore. |
AvroQuery<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)
|
void |
setCodecType(AvroStore.CodecType codecType)
|
void |
setDatumReader(org.apache.avro.io.DatumReader<T> datumReader)
|
void |
setDatumWriter(org.apache.avro.io.DatumWriter<T> datumWriter)
|
void |
setDecoder(org.apache.avro.io.Decoder decoder)
|
void |
setEncoder(org.apache.avro.io.Encoder encoder)
|
void |
write(DataOutput out)
|
Methods inherited from class org.apache.gora.store.impl.FileBackedDataStoreBase |
---|
createInputStream, createOutputStream, createSchema, deleteSchema, execute, getInputPath, getInputStream, getOrCreateInputStream, getOrCreateOutputStream, getOutputPath, getOutputStream, getPartitions, schemaExists, setInputPath, setInputStream, setOutputPath, setOutputStream |
Methods inherited from class org.apache.gora.store.impl.DataStoreBase |
---|
equals, get, getBeanFactory, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.conf.Configurable |
---|
setConf |
Methods inherited from interface org.apache.gora.store.DataStore |
---|
get, getBeanFactory, getKeyClass, getPersistentClass, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema |
Field Detail |
---|
public static final String CODEC_TYPE_KEY
Constructor Detail |
---|
public AvroStore()
Method Detail |
---|
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws IOException
DataStore
initialize
in interface DataStore<K,T extends Persistent>
initialize
in class FileBackedDataStoreBase<K,T extends Persistent>
keyClass
- the class of the keyspersistentClass
- the class of the persistent objectsproperties
- extra metadata
IOException
public void setCodecType(AvroStore.CodecType codecType)
public void setEncoder(org.apache.avro.io.Encoder encoder)
public void setDecoder(org.apache.avro.io.Decoder decoder)
public void setDatumReader(org.apache.avro.io.DatumReader<T> datumReader)
public void setDatumWriter(org.apache.avro.io.DatumWriter<T> datumWriter)
public void close() throws IOException
DataStore
close
in interface Closeable
close
in interface DataStore<K,T extends Persistent>
close
in class FileBackedDataStoreBase<K,T extends Persistent>
IOException
public boolean delete(K key) throws IOException
DataStore
delete
in interface DataStore<K,T extends Persistent>
key
- the key of the object
IOException
public long deleteByQuery(Query<K,T> query) throws IOException
DataStore
deleteByQuery
in interface DataStore<K,T extends Persistent>
query
- matching records to this query will be deleted
IOException
protected Result<K,T> executeQuery(Query<K,T> query) throws IOException
executeQuery
in class FileBackedDataStoreBase<K,T extends Persistent>
IOException
protected Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query) throws IOException
executePartial
in class FileBackedDataStoreBase<K,T extends Persistent>
IOException
public void flush() throws IOException
DataStore
flush
in interface DataStore<K,T extends Persistent>
flush
in class FileBackedDataStoreBase<K,T extends Persistent>
IOException
public T get(K key, String[] fields) throws IOException
DataStore
get
in interface DataStore<K,T extends Persistent>
key
- the key of the objectfields
- the fields required in the object. Pass null, to retrieve all fields
IOException
public AvroQuery<K,T> newQuery()
DataStore
newQuery
in interface DataStore<K,T extends Persistent>
public void put(K key, T obj) throws IOException
DataStore
put
in interface DataStore<K,T extends Persistent>
IOException
public org.apache.avro.io.Encoder getEncoder() throws IOException
IOException
public org.apache.avro.io.Decoder getDecoder() throws IOException
IOException
public org.apache.avro.io.DatumReader<T> getDatumReader()
public org.apache.avro.io.DatumWriter<T> getDatumWriter()
protected org.apache.avro.io.Encoder createEncoder() throws IOException
IOException
protected org.apache.avro.io.Decoder createDecoder() throws IOException
IOException
protected org.apache.avro.io.DatumWriter<T> createDatumWriter()
protected org.apache.avro.io.DatumReader<T> createDatumReader()
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface DataStore<K,T extends Persistent>
getConf
in interface org.apache.hadoop.conf.Configurable
getConf
in class DataStoreBase<K,T extends Persistent>
public void write(DataOutput out) throws IOException
write
in interface DataStore<K,T extends Persistent>
write
in interface org.apache.hadoop.io.Writable
write
in class FileBackedDataStoreBase<K,T extends Persistent>
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface DataStore<K,T extends Persistent>
readFields
in interface org.apache.hadoop.io.Writable
readFields
in class FileBackedDataStoreBase<K,T extends Persistent>
IOException
public String getSchemaName()
DataStore
getSchemaName
in interface DataStore<K,T extends Persistent>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |