public class MemoryTierConsumerAgent extends Object implements TierConsumerAgent
Constructor and Description |
---|
MemoryTierConsumerAgent(List<TieredStorageConsumerSpec> tieredStorageConsumerSpecs,
TieredStorageNettyService nettyService) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the consumer agent.
|
Optional<Buffer> |
getNextBuffer(TieredStoragePartitionId partitionId,
TieredStorageSubpartitionId subpartitionId,
int segmentId)
Get buffer from the consumer agent.
|
int |
peekNextBufferSubpartitionId(TieredStoragePartitionId partitionId,
ResultSubpartitionIndexSet indexSet)
Returns the index of the subpartition where the next buffer locates, or -1 if there is no
buffer available or the subpartition index does not belong to the specified indexSet.
|
void |
registerAvailabilityNotifier(AvailabilityNotifier notifier)
Register the notifier to notify the availability of a subpartition.
|
void |
setup(TieredStorageMemoryManager memoryManager)
The consumer agent may request buffers from the memory manager.
|
void |
start()
Start the consumer agent.
|
public MemoryTierConsumerAgent(List<TieredStorageConsumerSpec> tieredStorageConsumerSpecs, TieredStorageNettyService nettyService)
public void setup(TieredStorageMemoryManager memoryManager)
TierConsumerAgent
TieredStorageMemoryManager
should be integrated into the tier consumer agent. Since the
buffer pool is initialized after the creation of the client, the memory manager need to be
assigned after the buffer pool becomes available.setup
in interface TierConsumerAgent
public void start()
TierConsumerAgent
start
in interface TierConsumerAgent
public void registerAvailabilityNotifier(AvailabilityNotifier notifier)
TierConsumerAgent
registerAvailabilityNotifier
in interface TierConsumerAgent
notifier
- to notify availability.public int peekNextBufferSubpartitionId(TieredStoragePartitionId partitionId, ResultSubpartitionIndexSet indexSet) throws IOException
TierConsumerAgent
peekNextBufferSubpartitionId
in interface TierConsumerAgent
partitionId
- The index of the partition which the returned subpartition should belong
to.indexSet
- The indexes of the subpartitions expected.IOException
public Optional<Buffer> getNextBuffer(TieredStoragePartitionId partitionId, TieredStorageSubpartitionId subpartitionId, int segmentId)
TierConsumerAgent
getNextBuffer
in interface TierConsumerAgent
partitionId
- the id of partition.subpartitionId
- the id of subpartition.segmentId
- the id of segment.public void close() throws IOException
TierConsumerAgent
close
in interface TierConsumerAgent
IOException
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.