Class DirMarkerTracker
Designed to be used while scanning through the results of listObject calls, where are we assume the results come in alphanumeric sort order and parent entries before children.
This lets as assume that we can identify all leaf markers as those markers which were added to set of leaf markers and not subsequently removed as a child entries were discovered.
To avoid scanning datastructures excessively, the path of the parent directory of the last file added is cached. This allows for a quick bailout when many children of the same directory are returned in a listing.
Consult the directory_markers document for details on this feature, including terminology.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis is a marker entry stored in the map and returned as markers are deleted. -
Constructor Summary
ConstructorsConstructorDescriptionDirMarkerTracker(org.apache.hadoop.fs.Path basePath, boolean recordSurplusMarkers) Construct. -
Method Summary
Modifier and TypeMethodDescriptionfileFound(org.apache.hadoop.fs.Path path, String key, S3ALocatedFileStatus source) A file has been found.org.apache.hadoop.fs.PathGet the base path of the tracker.intorg.apache.hadoop.fs.PathMap<org.apache.hadoop.fs.Path,DirMarkerTracker.Marker> Get the map of leaf markers.intintHow many objects were found.intMap<org.apache.hadoop.fs.Path,DirMarkerTracker.Marker> Get the map of surplus markers.markerFound(org.apache.hadoop.fs.Path path, String key, S3ALocatedFileStatus source) A marker has been found; this may or may not be a leaf.toString()
-
Constructor Details
-
DirMarkerTracker
public DirMarkerTracker(org.apache.hadoop.fs.Path basePath, boolean recordSurplusMarkers) Construct.The base path is currently only used for information rather than validating paths supplied in other methods.
- Parameters:
basePath- base path of trackrecordSurplusMarkers- save surplus markers to a map?
-
-
Method Details
-
getBasePath
public org.apache.hadoop.fs.Path getBasePath()Get the base path of the tracker.- Returns:
- the path
-
markerFound
public List<DirMarkerTracker.Marker> markerFound(org.apache.hadoop.fs.Path path, String key, S3ALocatedFileStatus source) A marker has been found; this may or may not be a leaf.Trigger a move of all markers above it into the surplus map.
- Parameters:
path- marker pathkey- object keysource- listing source- Returns:
- the surplus markers found.
-
fileFound
public List<DirMarkerTracker.Marker> fileFound(org.apache.hadoop.fs.Path path, String key, S3ALocatedFileStatus source) A file has been found. Trigger a move of all markers above it into the surplus map.- Parameters:
path- marker pathkey- object keysource- listing source- Returns:
- the surplus markers found.
-
getLeafMarkers
Get the map of leaf markers.- Returns:
- all leaf markers.
-
getSurplusMarkers
Get the map of surplus markers.Empty if they were not being recorded.
- Returns:
- all surplus markers.
-
getLastDirChecked
public org.apache.hadoop.fs.Path getLastDirChecked() -
getObjectsFound
public int getObjectsFound()How many objects were found.- Returns:
- count
-
getScanCount
public int getScanCount() -
getFilesFound
public int getFilesFound() -
getMarkersFound
public int getMarkersFound() -
toString
-