T - public class AvroStore<K,T extends PersistentBase> extends FileBackedDataStoreBase<K,T> implements org.apache.hadoop.conf.Configurable
| Modifier and Type | Class and Description |
|---|---|
static class |
AvroStore.CodecType
The type of the avro Encoder/Decoder.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CODEC_TYPE_KEY
The property key specifying avro encoder/decoder type to use.
|
static org.slf4j.Logger |
LOG |
inputPath, inputSize, inputStream, outputPath, outputStreamautoCreateSchema, beanFactory, conf, fieldMap, keyClass, persistentClass, properties, schema| Constructor and Description |
|---|
AvroStore() |
| Modifier and Type | Method and Description |
|---|---|
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) |
createInputStream, createOutputStream, createSchema, deleteSchema, execute, getInputPath, getInputStream, getOrCreateInputStream, getOrCreateOutputStream, getOutputPath, getOutputStream, getPartitions, schemaExists, setInputPath, setInputStream, setOutputPath, setOutputStreamequals, get, getBeanFactory, getFields, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchemaclone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, getBeanFactory, getKeyClass, getPersistentClass, newKey, newPersistent, setBeanFactory, setKeyClass, setPersistentClass, truncateSchemapublic static final String CODEC_TYPE_KEY
public static final org.slf4j.Logger LOG
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
DataStoreinitialize in interface DataStore<K,T extends PersistentBase>initialize in class FileBackedDataStoreBase<K,T extends PersistentBase>keyClass - the class of the keyspersistentClass - the class of the persistent objectsproperties - extra metadatapublic 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()
DataStoreclose in interface Closeableclose in interface AutoCloseableclose in interface DataStore<K,T extends PersistentBase>close in class FileBackedDataStoreBase<K,T extends PersistentBase>public boolean delete(K key)
DataStoredelete in interface DataStore<K,T extends PersistentBase>key - the key of the objectpublic long deleteByQuery(Query<K,T> query)
DataStoredeleteByQuery in interface DataStore<K,T extends PersistentBase>query - matching records to this query will be deletedprotected Result<K,T> executeQuery(Query<K,T> query) throws IOException
executeQuery in class FileBackedDataStoreBase<K,T extends PersistentBase>IOExceptionprotected Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query) throws IOException
executePartial in class FileBackedDataStoreBase<K,T extends PersistentBase>IOExceptionpublic void flush()
DataStoreflush in interface DataStore<K,T extends PersistentBase>flush in class FileBackedDataStoreBase<K,T extends PersistentBase>public T get(K key, String[] fields)
DataStoreget in interface DataStore<K,T extends PersistentBase>key - the key of the objectfields - the fields required in the object. Pass null, to retrieve all fieldspublic AvroQuery<K,T> newQuery()
DataStorenewQuery in interface DataStore<K,T extends PersistentBase>public void put(K key, T obj)
DataStoreput in interface DataStore<K,T extends PersistentBase>public org.apache.avro.io.Encoder getEncoder()
throws IOException
IOExceptionpublic org.apache.avro.io.Decoder getDecoder()
throws IOException
IOExceptionpublic org.apache.avro.io.DatumReader<T> getDatumReader()
public org.apache.avro.io.DatumWriter<T> getDatumWriter()
protected org.apache.avro.io.Encoder createEncoder()
throws IOException
IOExceptionprotected org.apache.avro.io.Decoder createDecoder()
throws IOException
IOExceptionprotected 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 org.apache.hadoop.conf.ConfigurablegetConf in class DataStoreBase<K,T extends PersistentBase>public void write(DataOutput out)
write in interface org.apache.hadoop.io.Writablewrite in class FileBackedDataStoreBase<K,T extends PersistentBase>public void readFields(DataInput in)
readFields in interface org.apache.hadoop.io.WritablereadFields in class FileBackedDataStoreBase<K,T extends PersistentBase>public String getSchemaName()
DataStoregetSchemaName in interface DataStore<K,T extends PersistentBase>Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.