Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Marker ¶
type Marker struct {
// contains filtered or unexported fields
}
A Marker provides an interface for marking a single file on the filesystem. The marker may be atomically moved from name to name. Marker is not safe for concurrent use. Multiple processes may not read or move the same marker simultaneously. An Marker may only be constructed through LocateMarker.
Marker names must be unique within the directory.
func LocateMarker ¶
LocateMarker loads the current state of a marker. It returns a handle to the Marker that may be used to move the marker and the current value of the marker.
func (*Marker) Move ¶
Move atomically moves the marker to mark the provided filename. If Move returns a nil error, the new marker value is guaranteed to be persisted to stable storage. If Move returns an error, the current value of the marker may be the old value or the new value. Callers may retry a Move error.
If an error occurs while syncing the directory, Move panics.
The provided filename does not need to exist on the filesystem.
func (*Marker) NextIter ¶
NextIter returns the next iteration number that the marker will use. Clients may use this number for formulating filenames that are unused.
func (*Marker) RemoveObsolete ¶
RemoveObsolete removes any obsolete files discovered while locating the marker or files unable to be removed during Move.