public class AppenderatorImpl extends Object implements Appenderator
Constructor and Description |
---|
AppenderatorImpl(DataSchema schema,
AppenderatorConfig tuningConfig,
FireDepartmentMetrics metrics,
DataSegmentPusher dataSegmentPusher,
com.fasterxml.jackson.databind.ObjectMapper objectMapper,
QueryRunnerFactoryConglomerate conglomerate,
DataSegmentAnnouncer segmentAnnouncer,
com.metamx.emitter.service.ServiceEmitter emitter,
ExecutorService queryExecutorService,
IndexIO indexIO,
IndexMerger indexMerger,
Cache cache,
CacheConfig cacheConfig) |
Modifier and Type | Method and Description |
---|---|
int |
add(SegmentIdentifier identifier,
InputRow row,
com.google.common.base.Supplier<Committer> committerSupplier)
Add a row.
|
void |
clear()
Drop all in-memory and on-disk data, and forget any previously-remembered commit metadata.
|
void |
close()
Stop any currently-running processing and clean up after ourselves.
|
com.google.common.util.concurrent.ListenableFuture<?> |
drop(SegmentIdentifier identifier)
Drop all data associated with a particular pending segment.
|
String |
getDataSource()
Return the name of the dataSource associated with this Appenderator.
|
<T> QueryRunner<T> |
getQueryRunnerForIntervals(Query<T> query,
Iterable<org.joda.time.Interval> intervals)
Gets the Queryable for a given interval, the Queryable returned can be any version(s) or partitionNumber(s)
such that it represents the interval.
|
<T> QueryRunner<T> |
getQueryRunnerForSegments(Query<T> query,
Iterable<SegmentDescriptor> specs)
Gets the Queryable for a given list of SegmentSpecs.
|
int |
getRowCount(SegmentIdentifier identifier)
Returns the number of rows in a particular pending segment.
|
List<SegmentIdentifier> |
getSegments()
Returns a list of all currently active segments.
|
com.google.common.util.concurrent.ListenableFuture<Object> |
persistAll(Committer committer)
Persist any in-memory indexed data to durable storage.
|
com.google.common.util.concurrent.ListenableFuture<SegmentsAndMetadata> |
push(List<SegmentIdentifier> identifiers,
Committer committer)
Merge and push particular segments to deep storage.
|
Object |
startJob()
Perform any initial setup.
|
public AppenderatorImpl(DataSchema schema, AppenderatorConfig tuningConfig, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, com.fasterxml.jackson.databind.ObjectMapper objectMapper, QueryRunnerFactoryConglomerate conglomerate, DataSegmentAnnouncer segmentAnnouncer, com.metamx.emitter.service.ServiceEmitter emitter, ExecutorService queryExecutorService, IndexIO indexIO, IndexMerger indexMerger, Cache cache, CacheConfig cacheConfig)
public String getDataSource()
Appenderator
getDataSource
in interface Appenderator
public Object startJob()
Appenderator
startJob
in interface Appenderator
public int add(SegmentIdentifier identifier, InputRow row, com.google.common.base.Supplier<Committer> committerSupplier) throws IndexSizeExceededException, SegmentNotWritableException
Appenderator
If no pending segment exists for the provided identifier, a new one will be created.
This method may trigger a Appenderator.persistAll(Committer)
using the supplied Committer. If it does this, the
Committer is guaranteed to be *created* synchronously with the call to add, but will actually be used
asynchronously.
The add, clear, persistAll, and push methods should all be called from the same thread.
add
in interface Appenderator
identifier
- the segment into which this row should be addedrow
- the row to addcommitterSupplier
- supplier of a committer associated with all data that has been added, including this rowIndexSizeExceededException
- if this row cannot be added because it is too largeSegmentNotWritableException
- if the requested segment is known, but has been closedpublic List<SegmentIdentifier> getSegments()
Appenderator
getSegments
in interface Appenderator
public int getRowCount(SegmentIdentifier identifier)
Appenderator
getRowCount
in interface Appenderator
identifier
- segment to examinepublic <T> QueryRunner<T> getQueryRunnerForIntervals(Query<T> query, Iterable<org.joda.time.Interval> intervals)
QuerySegmentWalker
getQueryRunnerForIntervals
in interface QuerySegmentWalker
T
- query result typequery
- the query to find a Queryable forintervals
- the intervals to find a Queryable forpublic <T> QueryRunner<T> getQueryRunnerForSegments(Query<T> query, Iterable<SegmentDescriptor> specs)
QuerySegmentWalker
getQueryRunnerForSegments
in interface QuerySegmentWalker
T
- the query result typequery
- the query to return a Queryable forspecs
- the list of SegmentSpecs to find a Queryable forpublic void clear() throws InterruptedException
Appenderator
clear
in interface Appenderator
InterruptedException
public com.google.common.util.concurrent.ListenableFuture<?> drop(SegmentIdentifier identifier)
Appenderator
Appenderator.clear()
), any on-disk commit
metadata will remain unchanged. If there is no pending segment with this identifier, then this method will
do nothing.
You should not write to the dropped segment after calling "drop". If you need to drop all your data and
re-write it, consider Appenderator.clear()
instead.
drop
in interface Appenderator
identifier
- the pending segment to droppublic com.google.common.util.concurrent.ListenableFuture<Object> persistAll(Committer committer)
Appenderator
The add, clear, persistAll, and push methods should all be called from the same thread.
persistAll
in interface Appenderator
committer
- a committer associated with all data that has been added so farpublic com.google.common.util.concurrent.ListenableFuture<SegmentsAndMetadata> push(List<SegmentIdentifier> identifiers, Committer committer)
Appenderator
Appenderator.persistAll(Committer)
using the provided Committer.
After this method is called, you cannot add new data to any segments that were previously under construction.
The add, clear, persistAll, and push methods should all be called from the same thread.
push
in interface Appenderator
identifiers
- list of segments to pushcommitter
- a committer associated with all data that has been added so farpublic void close()
Appenderator
close
in interface Appenderator
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2011–2017. All rights reserved.