@InterfaceAudience.Private @InterfaceStability.Evolving public class DirListingMetadata extends Object
DirListingMetadata models a directory listing stored in a
MetadataStore. Instances of this class are mutable and thread-safe.| Modifier and Type | Field and Description |
|---|---|
static Collection<PathMetadata> |
EMPTY_DIR
Convenience parameter for passing into constructor.
|
| Constructor and Description |
|---|
DirListingMetadata(DirListingMetadata d)
Copy constructor.
|
DirListingMetadata(org.apache.hadoop.fs.Path path,
Collection<PathMetadata> listing,
boolean isAuthoritative)
Create a directory listing metadata container.
|
| Modifier and Type | Method and Description |
|---|---|
PathMetadata |
get(org.apache.hadoop.fs.Path childPath)
Lookup entry within this directory listing.
|
Collection<PathMetadata> |
getListing() |
org.apache.hadoop.fs.Path |
getPath() |
boolean |
isAuthoritative() |
Tristate |
isEmpty()
Is the underlying directory known to be empty?
|
Set<org.apache.hadoop.fs.Path> |
listTombstones() |
void |
markDeleted(org.apache.hadoop.fs.Path childPath)
Replace an entry with a tombstone.
|
int |
numEntries() |
String |
prettyPrint() |
void |
prettyPrint(StringBuilder sb)
Log contents to supplied StringBuilder in a pretty fashion.
|
boolean |
put(org.apache.hadoop.fs.FileStatus childFileStatus)
Add an entry to the directory listing.
|
void |
remove(org.apache.hadoop.fs.Path childPath)
Remove entry from this directory.
|
void |
setAuthoritative(boolean authoritative)
Marks this directory listing as full and authoritative.
|
String |
toString() |
DirListingMetadata |
withoutTombstones() |
public static final Collection<PathMetadata> EMPTY_DIR
public DirListingMetadata(org.apache.hadoop.fs.Path path,
Collection<PathMetadata> listing,
boolean isAuthoritative)
path - Path of the directory. If this path has a host component, then
all paths added later via put(FileStatus) must also have
the same host.listing - Entries in the directory.isAuthoritative - true iff listing is the full contents of the
directory, and the calling client reports that this may be cached as
the full and authoritative listing of all files in the directory.public DirListingMetadata(DirListingMetadata d)
d - the existing DirListingMetadata object.public org.apache.hadoop.fs.Path getPath()
Path of the directory that contains this listing.public Collection<PathMetadata> getListing()
public Set<org.apache.hadoop.fs.Path> listTombstones()
public DirListingMetadata withoutTombstones()
public int numEntries()
isAuthoritative() is
true.public boolean isAuthoritative()
MetadataStore that returned it.public Tristate isEmpty()
public void setAuthoritative(boolean authoritative)
authoritative - see isAuthoritative().public PathMetadata get(org.apache.hadoop.fs.Path childPath)
MetadataStore only tracks a partial set of the directory entries.
In the case where isAuthoritative() is true, however, this
function returns null iff the directory is known not to contain the listing
at given path (within the scope of the MetadataStore that returned
it).childPath - path of entry to look for.public void markDeleted(org.apache.hadoop.fs.Path childPath)
childPath - path of entry to replace.public void remove(org.apache.hadoop.fs.Path childPath)
childPath - path of entry to remove.public boolean put(org.apache.hadoop.fs.FileStatus childFileStatus)
FileStatus with the same path, it will be replaced.childFileStatus - entry to add to this directory listing.public void prettyPrint(StringBuilder sb)
sb - target StringBuilderpublic String prettyPrint()
Copyright © 2008–2019 Apache Software Foundation. All rights reserved.