Class AbstractAccess
- java.lang.Object
-
- com.exonum.binding.core.proxy.AbstractNativeProxy
-
- com.exonum.binding.core.storage.database.AbstractAccess
-
- All Implemented Interfaces:
Access
- Direct Known Subclasses:
Fork,Prefixed,RoErasedAccess,Snapshot
public abstract class AbstractAccess extends AbstractNativeProxy implements Access
Represents an access to the database.There are two sub-types:
- A snapshot, which is a read-only and immutable access.
- A fork, which is a read-write access.
-
-
Field Summary
-
Fields inherited from class com.exonum.binding.core.proxy.AbstractNativeProxy
nativeHandle
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanModify()Returns true if this access allows modifications to the database state; false if it is immutable.longgetAccessNativeHandle()Returns a native handle of this access.abstract CleanergetCleaner()Returns the cleaner of this access.<E> EntryIndex<E>getEntry(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)Creates a new Entry.<E> KeySetIndexProxy<E>getKeySet(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)Creates a new KeySet.<E> ListIndexProxy<E>getList(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)Creates a new ListIndex.<K,V>
MapIndexProxy<K,V>getMap(IndexAddress address, com.exonum.binding.common.serialization.Serializer<K> keySerializer, com.exonum.binding.common.serialization.Serializer<V> valueSerializer)Creates a new MapIndex.protected com.exonum.binding.core.storage.database.OpenIndexRegistrygetOpenIndexes()Returns the registry of open indexes for this Access.<E> ProofEntryIndex<E>getProofEntry(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)Creates a new ProofEntry.<E> ProofListIndexProxy<E>getProofList(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)Creates a new ProofListIndex.<K,V>
ProofMapIndexProxy<K,V>getProofMap(IndexAddress address, com.exonum.binding.common.serialization.Serializer<K> keySerializer, com.exonum.binding.common.serialization.Serializer<V> valueSerializer)Creates a new ProofMapIndex.<K,V>
ProofMapIndexProxy<K,V>getRawProofMap(IndexAddress address, com.exonum.binding.common.serialization.Serializer<K> keySerializer, com.exonum.binding.common.serialization.Serializer<V> valueSerializer)Creates a new "raw" ProofMapIndex.<E> ValueSetIndexProxy<E>getValueSet(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)Creates a new ValueSet.protected static booleannativeCanModify(long nativeHandle)Returns true if the native Access allows modifications to the storage.protected static voidnativeFree(long accessNativeHandle)Destroys the native `ErasedAccess` object.-
Methods inherited from class com.exonum.binding.core.proxy.AbstractNativeProxy
getNativeHandle, isValidHandle
-
-
-
-
Method Detail
-
getProofList
public <E> ProofListIndexProxy<E> getProofList(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)
Description copied from interface:AccessCreates a new ProofListIndex.- Specified by:
getProofListin interfaceAccess- Type Parameters:
E- the type of elements in this list- Parameters:
address- an index address in the MerkleDBserializer- a serializer of list elements- See Also:
StandardSerializers
-
getList
public <E> ListIndexProxy<E> getList(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)
Description copied from interface:AccessCreates a new ListIndex.- Specified by:
getListin interfaceAccess- Type Parameters:
E- the type of elements in this list- Parameters:
address- an index address in the MerkleDBserializer- a serializer of list elements- See Also:
Access.getProofList(IndexAddress, Serializer),StandardSerializers
-
getProofMap
public <K,V> ProofMapIndexProxy<K,V> getProofMap(IndexAddress address, com.exonum.binding.common.serialization.Serializer<K> keySerializer, com.exonum.binding.common.serialization.Serializer<V> valueSerializer)
Description copied from interface:AccessCreates a new ProofMapIndex.- Specified by:
getProofMapin interfaceAccess- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
address- an index address in the MerkleDBkeySerializer- a serializer of keysvalueSerializer- a serializer of values- See Also:
StandardSerializers
-
getRawProofMap
public <K,V> ProofMapIndexProxy<K,V> getRawProofMap(IndexAddress address, com.exonum.binding.common.serialization.Serializer<K> keySerializer, com.exonum.binding.common.serialization.Serializer<V> valueSerializer)
Description copied from interface:AccessCreates a new "raw" ProofMapIndex. A raw ProofMapIndex does not hash keys, hence imposes some requirements on them.- Specified by:
getRawProofMapin interfaceAccess- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
address- an index address in the MerkleDBkeySerializer- a serializer of keys, must always produce 32-byte long values that suit the requirementsvalueSerializer- a serializer of values- See Also:
Access.getProofMap(IndexAddress, Serializer, Serializer),StandardSerializers
-
getMap
public <K,V> MapIndexProxy<K,V> getMap(IndexAddress address, com.exonum.binding.common.serialization.Serializer<K> keySerializer, com.exonum.binding.common.serialization.Serializer<V> valueSerializer)
Description copied from interface:AccessCreates a new MapIndex.- Specified by:
getMapin interfaceAccess- Type Parameters:
K- the type of keys in the mapV- the type of values in the map- Parameters:
address- an index address in the MerkleDBkeySerializer- a serializer of keysvalueSerializer- a serializer of values- See Also:
Access.getProofMap(IndexAddress, Serializer, Serializer),StandardSerializers
-
getKeySet
public <E> KeySetIndexProxy<E> getKeySet(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)
Description copied from interface:AccessCreates a new KeySet.- Specified by:
getKeySetin interfaceAccess- Type Parameters:
E- the type of keys in this set- Parameters:
address- an index address in the MerkleDBserializer- a serializer of set keys- See Also:
Access.getValueSet(IndexAddress, Serializer),StandardSerializers
-
getValueSet
public <E> ValueSetIndexProxy<E> getValueSet(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)
Description copied from interface:AccessCreates a new ValueSet.- Specified by:
getValueSetin interfaceAccess- Type Parameters:
E- the type of values in this set- Parameters:
address- an index address in the MerkleDBserializer- a serializer of set values- See Also:
Access.getKeySet(IndexAddress, Serializer),StandardSerializers
-
getProofEntry
public <E> ProofEntryIndex<E> getProofEntry(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)
Description copied from interface:AccessCreates a new ProofEntry.- Specified by:
getProofEntryin interfaceAccess- Type Parameters:
E- the type of the entry- Parameters:
address- an index address in the MerkleDBserializer- an entry serializer- See Also:
StandardSerializers
-
getEntry
public <E> EntryIndex<E> getEntry(IndexAddress address, com.exonum.binding.common.serialization.Serializer<E> serializer)
Description copied from interface:AccessCreates a new Entry.
-
canModify
public boolean canModify()
Description copied from interface:AccessReturns true if this access allows modifications to the database state; false if it is immutable.
-
getAccessNativeHandle
public long getAccessNativeHandle()
Description copied from interface:AccessReturns a native handle of this access.- Specified by:
getAccessNativeHandlein interfaceAccess
-
getOpenIndexes
protected com.exonum.binding.core.storage.database.OpenIndexRegistry getOpenIndexes()
Returns the registry of open indexes for this Access.
-
getCleaner
public abstract Cleaner getCleaner()
Returns the cleaner of this access. It is supposed to be used with collections and other objects depending on this access.
-
nativeCanModify
protected static boolean nativeCanModify(long nativeHandle)
Returns true if the native Access allows modifications to the storage. Note that it may differ from the Java AccesscanModify()property (may be more permissive, but never — stricter).
-
nativeFree
protected static void nativeFree(long accessNativeHandle)
Destroys the native `ErasedAccess` object. May be used with Snapshots, Forks, and any other ErasedAccesses.
-
-