@InterfaceAudience.Private @InterfaceStability.Evolving public class DurablePositionTracker extends Object implements PositionTracker
Class that stores object state in an avro container file. The file is only ever appended to. At construction time, the object reads data from the end of the file and caches that data for use by a client application. After construction, reads never go to disk. Writes always flush to disk.
Note: This class is not thread-safe.
Modifier and Type | Method and Description |
---|---|
void |
close() |
static DurablePositionTracker |
getInstance(File trackerFile,
String target)
If the file exists at startup, then read it, roll it, and open a new one.
|
long |
getPosition() |
String |
getTarget() |
void |
storePosition(long position) |
public static DurablePositionTracker getInstance(File trackerFile, String target) throws IOException
trackerFile
- target
- IOException
public void storePosition(long position) throws IOException
storePosition
in interface PositionTracker
IOException
public long getPosition()
getPosition
in interface PositionTracker
public String getTarget()
getTarget
in interface PositionTracker
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface PositionTracker
IOException
Copyright © 2009-2018 Apache Software Foundation. All Rights Reserved.