public final class DiskBasedMap<T extends Serializable,R extends Serializable> extends Object implements Map<T,R>, Iterable<R>
| Modifier and Type | Class and Description |
|---|---|
static class |
DiskBasedMap.FileEntry
The file metadata that should be spilled to disk.
|
static class |
DiskBasedMap.ValueMetadata
The value relevant metadata.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE |
| Constructor and Description |
|---|
DiskBasedMap(String baseFilePath) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
close() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<T,R>> |
entrySet() |
static <R> R |
get(DiskBasedMap.ValueMetadata entry,
RandomAccessFile file) |
R |
get(Object key) |
boolean |
isEmpty() |
Iterator<R> |
iterator()
Custom iterator to iterate over values written to disk.
|
Set<T> |
keySet() |
R |
put(T key,
R value) |
void |
putAll(Map<? extends T,? extends R> m) |
R |
remove(Object key) |
int |
size() |
long |
sizeOfFileOnDiskInBytes()
Number of bytes spilled to disk.
|
Collection<R> |
values() |
Stream<R> |
valueStream() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllforEach, spliteratorpublic static final int BUFFER_SIZE
public DiskBasedMap(String baseFilePath) throws IOException
IOExceptionpublic Iterator<R> iterator()
iterator in interface Iterable<R extends Serializable>public long sizeOfFileOnDiskInBytes()
public int size()
size in interface Map<T extends Serializable,R extends Serializable>public boolean isEmpty()
isEmpty in interface Map<T extends Serializable,R extends Serializable>public boolean containsKey(Object key)
containsKey in interface Map<T extends Serializable,R extends Serializable>public boolean containsValue(Object value)
containsValue in interface Map<T extends Serializable,R extends Serializable>public R get(Object key)
get in interface Map<T extends Serializable,R extends Serializable>public static <R> R get(DiskBasedMap.ValueMetadata entry, RandomAccessFile file)
public R put(T key, R value)
put in interface Map<T extends Serializable,R extends Serializable>public R remove(Object key)
remove in interface Map<T extends Serializable,R extends Serializable>public void putAll(Map<? extends T,? extends R> m)
putAll in interface Map<T extends Serializable,R extends Serializable>public void clear()
clear in interface Map<T extends Serializable,R extends Serializable>public void close()
public Set<T> keySet()
keySet in interface Map<T extends Serializable,R extends Serializable>public Collection<R> values()
values in interface Map<T extends Serializable,R extends Serializable>public Set<Map.Entry<T,R>> entrySet()
entrySet in interface Map<T extends Serializable,R extends Serializable>Copyright © 2021 The Apache Software Foundation. All rights reserved.