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
-
Method Summary
Modifier and Type Method Description boolean
canModify()
Returns true if this access allows modifications to the database state; false if it is immutable.long
getAccessNativeHandle()
Returns a native handle of this access.abstract Cleaner
getCleaner()
Returns the cleaner of this access.<E> EntryIndex<E>
getEntry(IndexAddress address, Serializer<E> serializer)
Creates a new Entry.<E> KeySetIndexProxy<E>
getKeySet(IndexAddress address, Serializer<E> serializer)
Creates a new KeySet.<E> ListIndexProxy<E>
getList(IndexAddress address, Serializer<E> serializer)
Creates a new ListIndex.<K, V> MapIndexProxy<K,V>
getMap(IndexAddress address, Serializer<K> keySerializer, Serializer<V> valueSerializer)
Creates a new MapIndex.protected com.exonum.binding.core.storage.database.OpenIndexRegistry
getOpenIndexes()
Returns the registry of open indexes for this Access.<E> ProofEntryIndex<E>
getProofEntry(IndexAddress address, Serializer<E> serializer)
Creates a new ProofEntry.<E> ProofListIndexProxy<E>
getProofList(IndexAddress address, Serializer<E> serializer)
Creates a new ProofListIndex.<K, V> ProofMapIndexProxy<K,V>
getProofMap(IndexAddress address, Serializer<K> keySerializer, Serializer<V> valueSerializer)
Creates a new ProofMapIndex.<K, V> ProofMapIndexProxy<K,V>
getRawProofMap(IndexAddress address, Serializer<K> keySerializer, Serializer<V> valueSerializer)
Creates a new "raw" ProofMapIndex.<E> ValueSetIndexProxy<E>
getValueSet(IndexAddress address, Serializer<E> serializer)
Creates a new ValueSet.protected static boolean
nativeCanModify(long nativeHandle)
Returns true if the native Access allows modifications to the storage.protected static void
nativeFree(long accessNativeHandle)
Destroys the native `ErasedAccess` object.Methods inherited from class com.exonum.binding.core.proxy.AbstractNativeProxy
getNativeHandle, isValidHandle
-
Method Details
-
getProofList
Description copied from interface:Access
Creates a new ProofListIndex.- Specified by:
getProofList
in 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
Description copied from interface:Access
Creates a new ListIndex.- Specified by:
getList
in 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, Serializer<K> keySerializer, Serializer<V> valueSerializer)Description copied from interface:Access
Creates a new ProofMapIndex.- Specified by:
getProofMap
in 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, Serializer<K> keySerializer, Serializer<V> valueSerializer)Description copied from interface:Access
Creates a new "raw" ProofMapIndex. A raw ProofMapIndex does not hash keys, hence imposes some requirements on them.- Specified by:
getRawProofMap
in 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, Serializer<K> keySerializer, Serializer<V> valueSerializer)Description copied from interface:Access
Creates a new MapIndex.- Specified by:
getMap
in 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
Description copied from interface:Access
Creates a new KeySet.- Specified by:
getKeySet
in 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
Description copied from interface:Access
Creates a new ValueSet.- Specified by:
getValueSet
in 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
Description copied from interface:Access
Creates a new ProofEntry.- Specified by:
getProofEntry
in interfaceAccess
- Type Parameters:
E
- the type of the entry- Parameters:
address
- an index address in the MerkleDBserializer
- an entry serializer- See Also:
StandardSerializers
-
getEntry
Description copied from interface:Access
Creates a new Entry.- Specified by:
getEntry
in interfaceAccess
- Type Parameters:
E
- the type of the entry- Parameters:
address
- an index address in the MerkleDBserializer
- an entry serializer- See Also:
StandardSerializers
-
canModify
public boolean canModify()Description copied from interface:Access
Returns true if this access allows modifications to the database state; false if it is immutable. -
getAccessNativeHandle
public long getAccessNativeHandle()Description copied from interface:Access
Returns a native handle of this access.- Specified by:
getAccessNativeHandle
in interfaceAccess
-
getOpenIndexes
protected com.exonum.binding.core.storage.database.OpenIndexRegistry getOpenIndexes()Returns the registry of open indexes for this Access. -
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.
-