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 maintaining a single string value on the filesystem. The marker may be atomically moved from value to value.
The implementation creates a new marker file for each new value, embedding the value in the marker filename.
Marker is not safe for concurrent use. Multiple processes may not read or move the same marker simultaneously. A 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 a new value.
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.
func (*Marker) NextIter ¶
NextIter returns the next iteration number that the marker will use. Clients may use this number for formulating new values that are unused.
func (*Marker) RemoveObsolete ¶
RemoveObsolete removes any obsolete files discovered while locating the marker or files unable to be removed during Move.