public class StorageWithAnnotatedIncidence extends Object implements HGStoreImplementation
TODO - this could be used as a wrapper for any storage implementation, a wrapper that allows incidence set indexing to be augmented with additional attributes.
| Constructor and Description |
|---|
StorageWithAnnotatedIncidence(HGStoreImplementation wrapped) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIncidenceLink(HGPersistentHandle handle,
HGPersistentHandle newLink)
And an element to the incidence set of a given atom (as identified by the
handle
parameter). |
boolean |
containsData(HGPersistentHandle handle)
Return
true if the data space contains data with the given
handle and false otherwise. |
boolean |
containsLink(HGPersistentHandle handle)
Return
true if there is a primitive link for the given handle. |
Object |
getConfiguration()
Each different storage mechanism provides its own configuration object
with parameters that can be set before storage is initialized.
|
byte[] |
getData(HGPersistentHandle handle)
Return the data corresponding to a given handle or
null if it is not found. |
HGRandomAccessResult<HGPersistentHandle> |
getIncidenceResultSet(HGPersistentHandle handle)
Return the incidence set associate with the given handle.
|
long |
getIncidenceSetCardinality(HGPersistentHandle handle)
Return the number of elements of the incidence set for the given handle or 0
if no such set exists.
|
<KeyType,ValueType> |
getIndex(String name)
Get the HyperGraphDB index with the given name.
|
<KeyType,ValueType> |
getIndex(String name,
ByteArrayConverter<KeyType> keyConverter,
ByteArrayConverter<ValueType> valueConverter,
Comparator<?> comparator,
boolean isBidirectional,
boolean createIfNecessary)
Retrieve the index with the given name, or create a new index if no index with
that name exists.
|
HGPersistentHandle[] |
getLink(HGPersistentHandle handle)
Return the link corresponding to a given handle or
null if it is not found. |
HGTransactionFactory |
getTransactionFactory()
Return the transaction factory associated with this storage instance.
|
void |
removeData(HGPersistentHandle handle)
Remove the data corresponding to a given handle.
|
void |
removeIncidenceLink(HGPersistentHandle handle,
HGPersistentHandle oldLink)
Remove a specifiec element from the incidence set of a given atom (as identified by
the
handle parameter). |
void |
removeIncidenceSet(HGPersistentHandle handle)
Remove the incidence set associated with the given handle.
|
void |
removeIndex(String name)
Remove the index with the given name.
|
void |
removeLink(HGPersistentHandle handle)
Remove the link corresponding to a given handle.
|
void |
shutdown()
Stops the storage engine.
|
void |
startup(HGStore store,
HGConfiguration configuration)
Starts the storage engine.
|
HGPersistentHandle |
store(HGPersistentHandle handle,
byte[] data)
Store a raw data buffer and return its handle.
|
HGPersistentHandle |
store(HGPersistentHandle handle,
HGPersistentHandle[] link)
Store a primitive link and return its handle.
|
public StorageWithAnnotatedIncidence(HGStoreImplementation wrapped)
public Object getConfiguration()
HGStoreImplementationgetConfiguration in interface HGStoreImplementationpublic void startup(HGStore store, HGConfiguration configuration)
HGStoreImplementationStarts the storage engine.
This method is invoked after storage configuration parameters have been set and its purpose is to perform complete initialization for the underlying storage layer, possibly creating a new database instance. When this method returns, the storage should be ready for use.
startup in interface HGStoreImplementationpublic void shutdown()
HGStoreImplementationStops the storage engine.
This method is invoked when the database instance is closed. It is expected to perform all necessary cleanup and closing of resources of the storage layer.
shutdown in interface HGStoreImplementationpublic HGTransactionFactory getTransactionFactory()
HGStoreImplementationReturn the transaction factory associated with this storage instance. Storage implementations in HyperGraphDB are expected to be transactional and support snapshot isolation semantics.
getTransactionFactory in interface HGStoreImplementationpublic HGPersistentHandle store(HGPersistentHandle handle, HGPersistentHandle[] link)
HGStoreImplementationstore in interface HGStoreImplementationhandle - The handle to use as the identifier of the link.link - The primitive link. Neither the array nor any of its element can
be null.handle argument.public HGPersistentHandle[] getLink(HGPersistentHandle handle)
HGStoreImplementationnull if it is not found.getLink in interface HGStoreImplementationpublic void removeLink(HGPersistentHandle handle)
HGStoreImplementationremoveLink in interface HGStoreImplementationpublic boolean containsLink(HGPersistentHandle handle)
HGStoreImplementationtrue if there is a primitive link for the given handle.containsLink in interface HGStoreImplementationpublic HGPersistentHandle store(HGPersistentHandle handle, byte[] data)
HGStoreImplementationstore in interface HGStoreImplementationhandle - The handle to use as identifier within the data space.data - The buffer to store. There is no limit to the size of this buffer, but it can't be null.handle argument.public byte[] getData(HGPersistentHandle handle)
HGStoreImplementationnull if it is not found.getData in interface HGStoreImplementationpublic void removeData(HGPersistentHandle handle)
HGStoreImplementationremoveData in interface HGStoreImplementationpublic boolean containsData(HGPersistentHandle handle)
HGStoreImplementationtrue if the data space contains data with the given
handle and false otherwise.containsData in interface HGStoreImplementationpublic HGRandomAccessResult<HGPersistentHandle> getIncidenceResultSet(HGPersistentHandle handle)
HGStoreImplementationgetIncidenceResultSet in interface HGStoreImplementationpublic void removeIncidenceSet(HGPersistentHandle handle)
HGStoreImplementationremoveIncidenceSet in interface HGStoreImplementationpublic long getIncidenceSetCardinality(HGPersistentHandle handle)
HGStoreImplementationgetIncidenceSetCardinality in interface HGStoreImplementationpublic void addIncidenceLink(HGPersistentHandle handle, HGPersistentHandle newLink)
HGStoreImplementationhandle
parameter).addIncidenceLink in interface HGStoreImplementationpublic void removeIncidenceLink(HGPersistentHandle handle, HGPersistentHandle oldLink)
HGStoreImplementationhandle parameter).removeIncidenceLink in interface HGStoreImplementationpublic <KeyType,ValueType> HGIndex<KeyType,ValueType> getIndex(String name)
HGStoreImplementationnull if no
index with that name exists.getIndex in interface HGStoreImplementationpublic <KeyType,ValueType> HGIndex<KeyType,ValueType> getIndex(String name, ByteArrayConverter<KeyType> keyConverter, ByteArrayConverter<ValueType> valueConverter, Comparator<?> comparator, boolean isBidirectional, boolean createIfNecessary)
HGStoreImplementationgetIndex in interface HGStoreImplementationname - The name of the index. It must be unique for the storage layer.keyConverter - Converter to byte [] for the keys in this index. Necessary when creating
a new index. If null, a default converter should be used.valueConverter - Converter to byte [] for the values in this index. Necessary when creating
a new index. If null, a default converter should be used.public void removeIndex(String name)
HGStoreImplementationremoveIndex in interface HGStoreImplementationCopyright © 2015. All rights reserved.