Class FilePositionStore
java.lang.Object
com.arpnetworking.metrics.common.tailer.FilePositionStore
- All Implemented Interfaces:
PositionStore
,Closeable
,AutoCloseable
Implementation of
PositionStore
which stores the read
position in a file on local disk. This class is thread-safe per file
identifier.- Author:
- Ville Koskela (ville dot koskela at inscopemetrics dot io)
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getPosition
(String identifier) Get the read location in the file identified by a hash.void
setPosition
(String identifier, long position) Update the read offset from the beginning of the file for the specified file identifier.Generate a Steno log compatible representation.toString()
-
Method Details
-
getPosition
Description copied from interface:PositionStore
Get the read location in the file identified by a hash.- Specified by:
getPosition
in interfacePositionStore
- Parameters:
identifier
- unique identifier for the file.- Returns:
- Optional.absent if the file was not found, otherwise a byte offset
-
setPosition
Description copied from interface:PositionStore
Update the read offset from the beginning of the file for the specified file identifier.- Specified by:
setPosition
in interfacePositionStore
- Parameters:
identifier
- unique identifier for the file.position
- the new read offset from the beginning of the file in bytes.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
toLogValue
Generate a Steno log compatible representation.- Returns:
- Steno log compatible representation.
-
toString
-