Class View
java.lang.Object
com.exonum.binding.core.proxy.AbstractNativeProxy
com.exonum.binding.core.storage.database.View
public abstract class View extends AbstractNativeProxy
Represents a view of the database.
There are two sub-types:
- A snapshot, which is a read-only and immutable view.
- A fork, which is a read-write view.
-
Field Summary
-
Method Summary
Modifier and Type Method Description boolean
canModify()
Returns true if this view allows modifications to the database state; false if it is immutable.Optional<StorageIndex>
findOpenIndex(IndexAddress address)
Finds an open index by the given address.abstract Cleaner
getCleaner()
Returns the cleaner of this view.long
getViewNativeHandle()
Returns a native handle of this view.void
registerIndex(StorageIndex index)
Registers a new index created with this view.Methods inherited from class com.exonum.binding.core.proxy.AbstractNativeProxy
getNativeHandle, isValidHandle
-
Method Details
-
canModify
public boolean canModify()Returns true if this view allows modifications to the database state; false if it is immutable. -
getViewNativeHandle
public long getViewNativeHandle()Returns a native handle of this view.- Throws:
IllegalStateException
- if the view is invalid (closed or nullptr)
-
findOpenIndex
Finds an open index by the given address.This method is for internal use. It is not designed to be used by services, rather by index factories.
- Parameters:
address
- the index address- Returns:
- an index with the given address; or
Optional.empty()
if no index with such address was open in this view
-
registerIndex
Registers a new index created with this view.This method is for internal use. It is not designed to be used by services, rather by index factories.
- Parameters:
index
- a new index to register- Throws:
IllegalArgumentException
- if the index is already registered- See Also:
findOpenIndex(IndexAddress)
-
getCleaner
Returns the cleaner of this view. It is supposed to be used with collections and other objects depending on this view.
-