public class MemoryTierPartitionState extends java.lang.Object implements TierPartitionState
TierPartitionState.AppendResult
Constructor and Description |
---|
MemoryTierPartitionState(java.io.File dir,
org.apache.kafka.common.TopicPartition topicPartition,
boolean tieringEnabled) |
Modifier and Type | Method and Description |
---|---|
TierPartitionState.AppendResult |
append(AbstractTierMetadata entry)
Appends abstract metadata to the tier partition.
|
void |
beginCatchup()
Begin catchup phase for tier partition state.
|
void |
close()
Close TierPartition, flushing to disk.
|
void |
closeHandlers() |
java.util.Optional<java.lang.Long> |
committedEndOffset()
Return the end offset spanned by the TierPartitionState that has been committed to disk.
|
void |
delete()
Delete this TierPartitionState from local storage.
|
java.io.File |
dir()
The directory where the TierPartition is stored on disk.
|
java.util.Optional<java.lang.Long> |
endOffset()
Return the uncommitted end offset spanned by the TierPartitionState.
|
void |
flush()
flush data contained in this TierPartitionState to disk.
|
java.util.concurrent.Future<TierObjectMetadata> |
materializationListener(long targetOffset)
Sets up a listener for this tier partition state for use by the replica fetcher.
|
java.util.Optional<TierObjectMetadata> |
metadata(long targetOffset)
Lookup the TierObjectMetadata which will contain data for a target offset.
|
int |
numSegments()
Scan the ObjectMetadata (segment) entries in this tier partition, and return the count.
|
void |
onCatchUpComplete()
Mark catchup completed for tier partition state.
|
void |
onTieringEnable()
Called when tiering is enabled for this tier topic partition.
|
java.lang.String |
path()
Path to where the TierPartition is stored on disk.
|
java.util.NavigableSet<java.lang.Long> |
segmentOffsets()
Get the set of base offsets for all tiered segments.
|
java.util.NavigableSet<java.lang.Long> |
segmentOffsets(long from,
long to)
Get the set of base offsets for all tiered segments in a given range.
|
java.util.Optional<java.lang.Long> |
startOffset()
Determine start offset spanned by the TierPartitionState.
|
TierPartitionStatus |
status()
Return the current status of the TierPartitionState.
|
int |
tierEpoch()
Return the current tierEpoch.
|
boolean |
tieringEnabled() |
org.apache.kafka.common.TopicPartition |
topicPartition()
The topic-partition corresponding to this TierPartition.
|
long |
totalSize()
Sum the size of all segment spanned by this TierPartitionState.
|
void |
updateDir(java.io.File dir)
Update the directory reference for the log and indices in this segment.
|
public MemoryTierPartitionState(java.io.File dir, org.apache.kafka.common.TopicPartition topicPartition, boolean tieringEnabled)
public org.apache.kafka.common.TopicPartition topicPartition()
TierPartitionState
topicPartition
in interface TierPartitionState
public java.io.File dir()
TierPartitionState
dir
in interface TierPartitionState
public java.util.Optional<java.lang.Long> committedEndOffset()
TierPartitionState
committedEndOffset
in interface TierPartitionState
public java.util.Optional<java.lang.Long> endOffset()
TierPartitionState
endOffset
in interface TierPartitionState
public java.util.Optional<java.lang.Long> startOffset()
TierPartitionState
startOffset
in interface TierPartitionState
public java.util.concurrent.Future<TierObjectMetadata> materializationListener(long targetOffset) throws java.lang.UnsupportedOperationException
TierPartitionState
materializationListener
in interface TierPartitionState
targetOffset
- the offset awaiting materializationjava.lang.UnsupportedOperationException
public TierPartitionStatus status()
TierPartitionState
status
in interface TierPartitionState
public void updateDir(java.io.File dir)
TierPartitionState
updateDir
in interface TierPartitionState
dir
- The new directorypublic long totalSize()
TierPartitionState
totalSize
in interface TierPartitionState
public int tierEpoch()
TierPartitionState
tierEpoch
in interface TierPartitionState
public boolean tieringEnabled()
tieringEnabled
in interface TierPartitionState
public void onTieringEnable()
TierPartitionState
onTieringEnable
in interface TierPartitionState
public TierPartitionState.AppendResult append(AbstractTierMetadata entry)
TierPartitionState
append
in interface TierPartitionState
entry
- AbstractTierMetadata entry to be appended to the tier partition log.public java.lang.String path()
TierPartitionState
path
in interface TierPartitionState
public int numSegments()
TierPartitionState
numSegments
in interface TierPartitionState
public java.util.NavigableSet<java.lang.Long> segmentOffsets()
TierPartitionState
segmentOffsets
in interface TierPartitionState
public java.util.NavigableSet<java.lang.Long> segmentOffsets(long from, long to)
TierPartitionState
segmentOffsets
in interface TierPartitionState
from
- Start of the range, include segment which contains "from" (inclusive)to
- End of the range, upper bound exclusive offset to include or the end of the log if "to" is past the endpublic java.util.Optional<TierObjectMetadata> metadata(long targetOffset)
TierPartitionState
metadata
in interface TierPartitionState
targetOffset
- the target offset to lookup the overlapping or next metadata for.public void flush()
TierPartitionState
flush
in interface TierPartitionState
public void beginCatchup()
TierPartitionState
beginCatchup
in interface TierPartitionState
public void onCatchUpComplete()
TierPartitionState
onCatchUpComplete
in interface TierPartitionState
public void close()
TierPartitionState
close
in interface TierPartitionState
public void closeHandlers()
closeHandlers
in interface TierPartitionState
public void delete()
TierPartitionState
delete
in interface TierPartitionState