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, outputStream
autoCreateSchema, 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, setOutputStream
equals, get, getBeanFactory, getFields, getFieldsToQuery, getKeyClass, getOrCreateConf, getPersistentClass, getSchemaName, newKey, newPersistent, setBeanFactory, setConf, setKeyClass, setPersistentClass, truncateSchema
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getBeanFactory, getKeyClass, getPersistentClass, newKey, newPersistent, setBeanFactory, setKeyClass, setPersistentClass, truncateSchema
public static final String CODEC_TYPE_KEY
public static final org.slf4j.Logger LOG
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties)
DataStore
initialize
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()
DataStore
close
in interface Closeable
close
in interface AutoCloseable
close
in interface DataStore<K,T extends PersistentBase>
close
in class FileBackedDataStoreBase<K,T extends PersistentBase>
public boolean delete(K key)
DataStore
delete
in interface DataStore<K,T extends PersistentBase>
key
- the key of the objectpublic long deleteByQuery(Query<K,T> query)
DataStore
deleteByQuery
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>
IOException
protected Result<K,T> executePartial(FileSplitPartitionQuery<K,T> query) throws IOException
executePartial
in class FileBackedDataStoreBase<K,T extends PersistentBase>
IOException
public void flush()
DataStore
flush
in interface DataStore<K,T extends PersistentBase>
flush
in class FileBackedDataStoreBase<K,T extends PersistentBase>
public T get(K key, String[] fields)
DataStore
get
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()
DataStore
newQuery
in interface DataStore<K,T extends PersistentBase>
public void put(K key, T obj)
DataStore
put
in interface DataStore<K,T extends PersistentBase>
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 org.apache.hadoop.conf.Configurable
getConf
in class DataStoreBase<K,T extends PersistentBase>
public void write(DataOutput out)
write
in interface org.apache.hadoop.io.Writable
write
in class FileBackedDataStoreBase<K,T extends PersistentBase>
public void readFields(DataInput in)
readFields
in interface org.apache.hadoop.io.Writable
readFields
in class FileBackedDataStoreBase<K,T extends PersistentBase>
public String getSchemaName()
DataStore
getSchemaName
in interface DataStore<K,T extends PersistentBase>
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.