@Public
@Stable
public class MapFile
extends java.lang.Object
A map is a directory containing two files, the data file,
containing all keys and values in the map, and a smaller index
file, containing a fraction of the keys. The fraction is determined by
MapFile.Writer.getIndexInterval().
The index file is read entirely into memory. Thus key implementations should try to keep themselves small.
Map files are created by adding entries in-order. To maintain a large
database, perform updates by copying the previous version of a database and
merging in a sorted change list, to create a new version of the database in
a new file. Sorting large change lists can be done with SequenceFile.Sorter.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
MapFile.Merger |
Class to merge multiple MapFiles of same Key and Value types to one MapFile
|
static class |
MapFile.Reader |
Provide access to an existing map.
|
static class |
MapFile.Writer |
Writes a new map.
|
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
DATA_FILE_NAME |
The name of the data file.
|
static java.lang.String |
INDEX_FILE_NAME |
The name of the index file.
|
| Modifier | Constructor | Description |
|---|---|---|
protected |
MapFile() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
delete(FileSystem fs,
java.lang.String name) |
Deletes the named map file.
|
static long |
fix(FileSystem fs,
Path dir,
java.lang.Class<? extends Writable> keyClass,
java.lang.Class<? extends Writable> valueClass,
boolean dryrun,
Configuration conf) |
This method attempts to fix a corrupt MapFile by re-creating its index.
|
static void |
main(java.lang.String[] args) |
|
static void |
rename(FileSystem fs,
java.lang.String oldName,
java.lang.String newName) |
Renames an existing map directory.
|
public static final java.lang.String INDEX_FILE_NAME
public static final java.lang.String DATA_FILE_NAME
public static void rename(FileSystem fs, java.lang.String oldName, java.lang.String newName) throws java.io.IOException
fs - fs.oldName - oldName.newName - newName.java.io.IOException - raised on errors performing I/O.public static void delete(FileSystem fs, java.lang.String name) throws java.io.IOException
fs - input fs.name - input name.java.io.IOException - raised on errors performing I/O.public static long fix(FileSystem fs, Path dir, java.lang.Class<? extends Writable> keyClass, java.lang.Class<? extends Writable> valueClass, boolean dryrun, Configuration conf) throws java.lang.Exception
fs - filesystemdir - directory containing the MapFile data and indexkeyClass - key class (has to be a subclass of Writable)valueClass - value class (has to be a subclass of Writable)dryrun - do not perform any changes, just report what needs to be doneconf - configuration.java.lang.Exception - Exception.public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.ExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.