Package com.exonum.binding.core.storage.indices
Indexes are also known as collections, tables, and rarely as database views.
Accessing indexes
Indexes shall be created using the database
Access
object.
Modifications
Whether an index can be modified is inherited from the Access object. If the database access
objects forbids modifications, any modifying (or "destructive") methods of the index
will throw UnsupportedOperationException
.
Index families
An index family is a named group of indexes of the same type. Each index in the group is identified by an identifier, an arbitrary byte string. An index in the group works the same as an individual index. Indexes in a family are isolated from each other. It is not possible to iterate through all elements that are stored inside an index group.
Use cases
Index families provide a way to separate elements by a certain criterion. Applications include indexing, where you create a separate collection group to index another collection of elements by a certain criterion; referencing another collection Bar from elements of collection Foo, where you keep an identifier into a collection in group Bar in a structure stored in collection Foo.
Limitations
Currently Exonum prepends an index identifier within a group to internal, implementation-specific, keys of that index to keep their elements separate from each other. The resulting database key includes the index identifier followed by the internal index key. Such implementation of index separation implies that each index identifier withing a group must not be a prefix of another index identifier in this group. The easiest way to achieve that is to use fixed-length identifiers.
Until this limitation is fixed, care must be taken when using this feature, because the identifiers are not checked.
- See Also:
- Exonum indexes reference documentation
-
Interface Summary Interface Description EntryIndex<T> An Entry is a database index that may or may not contain a single value.HashableIndex A hashable index provides a cryptographic hash which represents the complete state of this index.ListIndex<T> A list index proxy is a contiguous list of elements.MapIndex<K,V> A MapIndex is an index that maps keys to values.ProofEntryIndex<T> A proof entry is a hashable variant ofEntryIndex
.StorageIndex Storage index is a persistent, named collection built on top of Exonum key-value storage. -
Class Summary Class Description EntryIndexProxy<T> A proxy of a native MerkleDB Entry.IndexAddress An Exonum index address: a pair of the name and an optional id in a group, which identifies an Exonum index.KeySetIndexProxy<E> A key set is an index that contains no duplicate elements (keys).ListIndexProxy<E> A list index proxy is a contiguous list of elements.ListProof A view of aProofListIndexProxy
, i.e., a subset of its elements coupled with a proof, which jointly allow restoring the index hash of the list.MapIndexProxy<K,V> A MapIndex is an index that maps keys to values.MapProof A view of aProofMapIndexProxy
, i.e., a subset of its entries coupled with a proof, which jointly allow restoring the index hash of the map.ProofEntryIndexProxy<T> A proxy of a native MerkleDB ProofEntry.ProofListIndexProxy<E> A proof list index proxy is a contiguous list of elements, capable of providing cryptographic proofs that it contains a certain element at a particular position.ProofMapIndexProxy<K,V> A ProofMapIndexProxy is an index that maps keys to values.ValueSetIndexProxy<E> A value set is an index that contains no duplicate elements (values).ValueSetIndexProxy.Entry<E> An entry of a value set index: a hash-value pair.