Class View

java.lang.Object
com.exonum.binding.core.proxy.AbstractNativeProxy
com.exonum.binding.core.storage.database.View
Direct Known Subclasses:
Fork, Snapshot

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.
See Also:
Snapshot, Fork
  • 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

      public Optional<StorageIndex> findOpenIndex​(IndexAddress address)
      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

      public void registerIndex​(StorageIndex index)
      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

      public abstract Cleaner getCleaner()
      Returns the cleaner of this view. It is supposed to be used with collections and other objects depending on this view.