Package io.pravega.client.segment.impl
Interface SegmentMetadataClient
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface SegmentMetadataClient extends java.lang.AutoCloseableA client for looking at and editing the metadata related to a specific segment.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()booleancompareAndSetAttribute(SegmentAttribute attribute, long expectedValue, long newValue)Atomically replaces the value of attribute with newValue if it is expectedValue.longfetchCurrentSegmentLength()Returns the length of the current segment.longfetchProperty(SegmentAttribute attribute)Gets the current value of the provided attribute.SegmentInfogetSegmentInfo()Returns info for the current segment.voidsealSegment()Seals the segment so that no more writes can go to it.voidtruncateSegment(long offset)Deletes all data before the offset of the provided segment.
-
-
-
Method Detail
-
getSegmentInfo
SegmentInfo getSegmentInfo()
Returns info for the current segment.- Returns:
- Metadata about the segment.
-
fetchCurrentSegmentLength
long fetchCurrentSegmentLength()
Returns the length of the current segment. i.e. the total length of all data written to the segment.- Returns:
- The length of the current segment.
-
fetchProperty
long fetchProperty(SegmentAttribute attribute)
Gets the current value of the provided attribute.- Parameters:
attribute- The attribute to get the value of.- Returns:
- The value of the attribute or
SegmentAttribute.NULL_VALUEif it is not set.
-
compareAndSetAttribute
boolean compareAndSetAttribute(SegmentAttribute attribute, long expectedValue, long newValue)
Atomically replaces the value of attribute with newValue if it is expectedValue.- Parameters:
attribute- The attribute to setexpectedValue- The value the attribute is expected to benewValue- The new value for the attribute- Returns:
- If the replacement occurred. (False if the attribute was not expectedValue)
-
truncateSegment
void truncateSegment(long offset)
Deletes all data before the offset of the provided segment. This data will no longer be readable. Existing offsets are not affected by this operations. The new startingOffset will be reflected ingetSegmentInfo().SegmentInfo.getStartingOffset().- Parameters:
offset- The offset the segment should be truncated at.
-
sealSegment
void sealSegment()
Seals the segment so that no more writes can go to it.
-
close
void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-