All read and write operations can happen concurrently with all other operations, without risk of corruption.
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | |
| public static class | |
| public static enum | MVMap.
The decision on what to do on an update. |
| public abstract static class | MVMap.
value type of the map V>Class DecisionMaker provides callback interface (and should become a such in Java 8) for MVMap.operate method. |
| private static class | |
| private static class | |
| public static interface | MVMap.
the map type M extends MVMapthe key type K, the value type V>A builder for maps. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicLong | |
| private final AtomicLong | |
| private volatile boolean | closed
Whether the map is closed. |
| private final long | |
| private final int | |
| private boolean | |
| private final K[] | |
| private final int | |
| private final DataType | |
| private final Object | |
| private volatile boolean | |
| private boolean | |
| private final AtomicReference | root
Reference to the current root page. |
| private final boolean | |
| public final MVStore | store
The store. |
| private final V[] | |
| private final DataType |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | |
| pack-priv | |
| private | MVMap(MVStore store, DataType<K> keyType, DataType<V> valueType, int id, long createVersion, AtomicReference<RootReference<K, V>> root, int keysPerPage, boolean singleWriter)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | append(K
should be higher in map's order than any existing key key, V to be appended value)Appends entry to this map. |
| pack-priv static < type of values to compare X> boolean | Returns: true if they are equalto use for comparison datatype, X the first value a, X the second value b)Check whether the two values are equal. |
| protected String | |
| protected final void | |
| private static <T> int | |
| public final K | Returns: the resultthe key key)Get the smallest key that is larger or equal to this key. |
| public void | |
| pack-priv RootReference | |
| protected MVMap | |
| pack-priv final void | |
| pack-priv final int | Returns: -1 if the first key is smaller, 1 if bigger, 0 if equalthe first key a, K the second key b)Compare two keys. |
| pack-priv final boolean | Returns: whether updating workedthe old (expected) expectedRootReference, RootReference<K, V> the new updatedRootReference)Compare and set the root reference. |
| public final boolean | containsKey(Object
key whose presence in this map is to be tested key)Overrides java. Implements java. Returns |
| private void | |
| pack-priv final void | |
| protected Page | |
| protected Page | |
| public final Cursor | Returns: the cursorthe first key to return from)Get a cursor to iterate over a number of keys and values in the latest version of this map. |
| public final Cursor | Returns: the cursorthe first key to return from, K the last key to return to, boolean if true, iterate in reverse (descending) order reverse)Get a cursor to iterate over a number of keys and values in the latest version of this map. |
| public Cursor | Returns: the cursorof this map's version to iterate over rootReference, K the first key to return from, K the last key to return to, boolean if true, iterate in reverse (descending) order reverse)Get a cursor to iterate over a number of keys and values. |
| public final Set | entrySet()
Implements abstract java. Implements java. Returns a |
| public final boolean | equals(Object
object to be compared for equality with this map o)Overrides java. Implements java. Compares the specified object with this map for equality. |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv final int | |
| pack-priv final int | |
| public final K | |
| public final K | |
| public RootReference | Returns: current root referenceGet the root reference, flushing any current append buffer. |
| private RootReference | Returns: potentially updated RootReferencecurrent RootReference rootReference, boolean whether buffer should be completely flushed,
otherwise just a single empty slot is required fullFlush)If map was used in append mode, this method will ensure that append buffer is flushed - emptied with all entries inserted into map as a new leaf. |
| public final V | Returns: the value, or null if not foundthe key key)Overrides java. Implements java. Get the value for the given key, or null if not found. |
| public V | |
| protected int | Returns: the number of direct childrenthe page p)Get the child page count for this page. |
| pack-priv final long | |
| private K | Returns: the key, or null if the map is emptywhether to retrieve the first key first)Get the first (lowest) or last (largest) key. |
| private K | |
| public final int | Returns: the map idGet the map id. Please note the map id may be different after compacting a store. |
| public final K | |
| public final long | |
| public final DataType | |
| pack-priv static String | |
| pack-priv static String | Returns: the metadata keythe map id mapId)Get the metadata key for the root of the given map id. |
| private K | Returns: the key, or null if no such key existsthe key key, boolean whether to retrieve the smallest key min, boolean if the given upper/lower bound is exclusive excluding)Get the smallest or largest key using the given bounds. |
| private K | |
| private K | |
| public final String | |
| public RootReference | |
| public final Page | |
| public final MVStore | |
| public String | |
| public final DataType | |
| public final long | Returns: versionGet version of the map, which is the version of the store, at the moment when map was modified last time. |
| pack-priv final boolean | Returns: true if has changesroot version version)Does the root have changes since the specified version? |
| public final int | hashCode()
Overrides java. Implements java. Returns the hash code value for this map. |
| public final K | Returns: the resultthe key key)Get the smallest key that is larger than the given key (next key in ascending order), or null if no such key exists. |
| public final K | Returns: the resultthe root reference of the map rootRef, K to start from key)Get the smallest key that is larger than the given key, for the given root page, or null if no such key exists. |
| public final boolean | |
| public boolean | isEmpty()
Overrides java. Implements java. Returns |
| pack-priv final boolean | |
| protected final boolean | |
| public final boolean | |
| pack-priv boolean | |
| public final boolean | Returns: whether this map is volatileWhether this is volatile map, meaning that changes are not persisted. |
| public final Iterator | |
| public final Iterator | Returns: the iteratorthe first key to return from)Iterate over a number of keys in reverse order |
| public final List | |
| public Set | keySet()
Overrides java. Implements java. Returns a |
| public final K | |
| private RootReference | |
| public final K | Returns: the resultthe key key)Get the largest key that is smaller than the given key, or null if no such key exists. |
| public final K | Returns: the resultthe root page rootRef, K the key key)Get the largest key that is smaller than the given key, for the given root page, or null if no such key exists. |
| private void | |
| pack-priv final MVMap | Returns: the opened mapposition of the root page rootPos, long to open version)Open a copy of the map in read-only mode. |
| private MVMap | |
| public final MVMap | |
| public V | Returns: previous value, if mapping for that key existed, or null otherwisethe key (may not be null) key, V new value, it may be null when removal is intended value, MVMap.command object to make choices during transaction. decisionMakerAdd, replace or remove a key-value pair. |
| public V | Returns: the old value if the key existed, or null otherwisethe key (may not be null) key, V the value (may not be null) value)Overrides java. Implements java. Add or replace a key-value pair. |
| public final V | Returns: the old value if the key existed, or null otherwisethe key (may not be null) key, V the new value value)Overrides default java. Implements java. Add a key-value pair if it does not yet exist. |
| private Page | |
| pack-priv final Page | |
| protected final void | |
| public V | Returns: the old value if the key existed, or null otherwisethe key (may not be null) key)Overrides java. Implements java. Remove a key-value pair, if the key exists. |
| public boolean | Returns: true if the item was removedthe key (may not be null) key, Object the expected value value)Overrides default java. Implements java. Remove a key-value pair if the value matches the stored one. |
| private void | removeUnusedOldVersions(RootReference<K, V>
to inspect rootReference)Forget those old versions that are no longer needed. |
| public final boolean | Returns: true if the value was replacedthe key (may not be null) key, V the expected value oldValue, V the new value newValue)Overrides default java. Implements java. Replace a value for an existing key, if the value matches. |
| public final V | Returns: the old value, if the value was replaced, or nullthe key (may not be null) key, V the new value value)Overrides default java. Implements java. Replace a value for an existing key. |
| private static <K, V> Page | |
| pack-priv final boolean | |
| pack-priv boolean | Returns: true if rollback was a success, false if there was not enough in-memory historyto rollback to version)Roll the root back to the specified version. |
| pack-priv final void | |
| pack-priv static int | |
| pack-priv final void | |
| pack-priv final void | setRootPos(long
the position, 0 for empty rootPos, long to set for this map version)Set the position of the root page. |
| public final void | |
| pack-priv final RootReference | |
| public final int | Returns: the number of entries, as an integerOverrides java. Implements java. Get the number of entries, as a integer. |
| public final long | |
| public final String | |
| public void | |
| protected RootReference | Returns: the new root referencethe old root reference rootReference, int the number of attempts so far attempt)Try to lock the root. |
| private RootReference | Returns: the new root reference (never null)Unlock the root page, the new root being null. |
| protected RootReference | Returns: the new root reference (never null)the new root newRootPage)Unlock the root page. |
| private void | |
| private RootReference | |
| protected static < the key class K, the value class V> boolean | Returns: new RootReference or null if update failedexpected current root reference expectedRootReference, Page<K, V> the new root page newRootPage, int how many attempt (including current)
were made to update root attemptUpdateCounter)Use the new root page from now on. |