@InterfaceAudience.Private @InterfaceStability.Evolving public interface MetadataStore extends Closeable
MetadataStore defines the set of operations that any metadata store
implementation must provide. Note that all Path objects provided
to methods must be absolute, not relative paths.
Implementations must implement any retries needed internally, such that
transient errors are generally recovered from without throwing exceptions
from this API.| Modifier and Type | Method and Description |
|---|---|
void |
delete(org.apache.hadoop.fs.Path path)
Deletes exactly one path, leaving a tombstone to prevent lingering,
inconsistent copies of it from being listed.
|
void |
deleteSubtree(org.apache.hadoop.fs.Path path)
Deletes the entire sub-tree rooted at the given path, leaving tombstones
to prevent lingering, inconsistent copies of it from being listed.
|
void |
destroy()
Destroy all resources associated with the metadata store.
|
void |
forgetMetadata(org.apache.hadoop.fs.Path path)
Removes the record of exactly one path.
|
PathMetadata |
get(org.apache.hadoop.fs.Path path)
Gets metadata for a path.
|
PathMetadata |
get(org.apache.hadoop.fs.Path path,
boolean wantEmptyDirectoryFlag)
Gets metadata for a path.
|
Map<String,String> |
getDiagnostics()
Get any diagnostics information from a store, as a list of (key, value)
tuples for display.
|
void |
initialize(org.apache.hadoop.conf.Configuration conf)
Performs one-time initialization of the metadata store via configuration.
|
void |
initialize(org.apache.hadoop.fs.FileSystem fs)
Performs one-time initialization of the metadata store.
|
DirListingMetadata |
listChildren(org.apache.hadoop.fs.Path path)
Lists metadata for all direct children of a path.
|
void |
move(Collection<org.apache.hadoop.fs.Path> pathsToDelete,
Collection<PathMetadata> pathsToCreate)
Record the effects of a
FileSystem.rename(Path, Path) in the
MetadataStore. |
void |
prune(long modTime)
Clear any metadata older than a specified time from the repository.
|
void |
prune(long modTime,
String keyPrefix)
Same as
prune(long), but with an additional
keyPrefix parameter to filter the pruned keys with a prefix. |
void |
put(Collection<PathMetadata> metas)
Saves metadata for any number of paths.
|
void |
put(DirListingMetadata meta)
Save directory listing metadata.
|
void |
put(PathMetadata meta)
Saves metadata for exactly one path.
|
void |
updateParameters(Map<String,String> parameters)
Tune/update parameters for an existing table.
|
void initialize(org.apache.hadoop.fs.FileSystem fs)
throws IOException
fs - FileSystem associated with the MetadataStoreIOException - if there is an errorvoid initialize(org.apache.hadoop.conf.Configuration conf)
throws IOException
conf - Configuration.IOException - if there is an errorinitialize(FileSystem)void delete(org.apache.hadoop.fs.Path path)
throws IOException
path - the path to deleteIOException - if there is an errorvoid forgetMetadata(org.apache.hadoop.fs.Path path)
throws IOException
delete(Path). It is currently intended for testing
only, and a need to use it as part of normal FileSystem usage is not
anticipated.path - the path to deleteIOException - if there is an errorvoid deleteSubtree(org.apache.hadoop.fs.Path path)
throws IOException
get(Path),
implementations must also update any stored DirListingMetadata
objects which track the parent of this file.path - the root of the sub-tree to deleteIOException - if there is an errorPathMetadata get(org.apache.hadoop.fs.Path path) throws IOException
path - the path to getpath, null if not foundIOException - if there is an errorPathMetadata get(org.apache.hadoop.fs.Path path, boolean wantEmptyDirectoryFlag) throws IOException
PathMetadata.isEmptyDirectory(). Since determining emptiness
may be an expensive operation, this can save wasted work.path - the path to getwantEmptyDirectoryFlag - Set to true to give a hint to the
MetadataStore that it should try to compute the empty directory flag.path, null if not foundIOException - if there is an errorDirListingMetadata listChildren(org.apache.hadoop.fs.Path path) throws IOException
path - the path to listpath which are being
tracked by the MetadataStore, or null if the path was not found
in the MetadataStore.IOException - if there is an errorvoid move(Collection<org.apache.hadoop.fs.Path> pathsToDelete, Collection<PathMetadata> pathsToCreate) throws IOException
FileSystem.rename(Path, Path) in the
MetadataStore. Clients provide explicit enumeration of the affected
paths (recursively), before and after the rename.
This operation is not atomic, unless specific implementations claim
otherwise.
On the need to provide an enumeration of directory trees instead of just
source and destination paths:
Since a MetadataStore does not have to track all metadata for the
underlying storage system, and a new MetadataStore may be created on an
existing underlying filesystem, this move() may be the first time the
MetadataStore sees the affected paths. Therefore, simply providing src
and destination paths may not be enough to record the deletions (under
src path) and creations (at destination) that are happening during the
rename().pathsToDelete - Collection of all paths that were removed from the
source directory tree of the move.pathsToCreate - Collection of all PathMetadata for the new paths
that were created at the destination of the rename
().IOException - if there is an errorvoid put(PathMetadata meta) throws IOException
DirListingMetadata objects which
track the immediate parent of this file.meta - the metadata to saveIOException - if there is an errorvoid put(Collection<PathMetadata> metas) throws IOException
metas - the metadata to saveIOException - if there is an errorvoid put(DirListingMetadata meta) throws IOException
MetadataStore implementations may
subsequently keep track of all modifications to the directory contents at
this path, and return authoritative results from subsequent calls to
listChildren(Path). See DirListingMetadata.
Any authoritative results returned are only authoritative for the scope
of the MetadataStore: A per-process MetadataStore, for
example, would only show results visible to that process, potentially
missing metadata updates (create, delete) made to the same path by
another process.meta - Directory listing metadata.IOException - if there is an errorvoid destroy()
throws IOException
IOException - if there is an errorvoid prune(long modTime)
throws IOException,
UnsupportedOperationException
modTime - Oldest modification time to allowIOException - if there is an errorUnsupportedOperationException - if not implementedvoid prune(long modTime,
String keyPrefix)
throws IOException,
UnsupportedOperationException
prune(long), but with an additional
keyPrefix parameter to filter the pruned keys with a prefix.modTime - Oldest modification time to allowkeyPrefix - The prefix for the keys that should be removedIOException - if there is an errorUnsupportedOperationException - if not implementedMap<String,String> getDiagnostics() throws IOException
IOException - if there is an errorvoid updateParameters(Map<String,String> parameters) throws IOException
parameters - map of params to change.IOException - if there is an errorCopyright © 2008–2019 Apache Software Foundation. All rights reserved.