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()
HGStoreImplementation
getConfiguration
in interface HGStoreImplementation
public void startup(HGStore store, HGConfiguration configuration)
HGStoreImplementation
Starts 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 HGStoreImplementation
public void shutdown()
HGStoreImplementation
Stops 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 HGStoreImplementation
public HGTransactionFactory getTransactionFactory()
HGStoreImplementation
Return 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 HGStoreImplementation
public HGPersistentHandle store(HGPersistentHandle handle, HGPersistentHandle[] link)
HGStoreImplementation
store
in interface HGStoreImplementation
handle
- 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)
HGStoreImplementation
null
if it is not found.getLink
in interface HGStoreImplementation
public void removeLink(HGPersistentHandle handle)
HGStoreImplementation
removeLink
in interface HGStoreImplementation
public boolean containsLink(HGPersistentHandle handle)
HGStoreImplementation
true
if there is a primitive link for the given handle.containsLink
in interface HGStoreImplementation
public HGPersistentHandle store(HGPersistentHandle handle, byte[] data)
HGStoreImplementation
store
in interface HGStoreImplementation
handle
- 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)
HGStoreImplementation
null
if it is not found.getData
in interface HGStoreImplementation
public void removeData(HGPersistentHandle handle)
HGStoreImplementation
removeData
in interface HGStoreImplementation
public boolean containsData(HGPersistentHandle handle)
HGStoreImplementation
true
if the data space contains data with the given
handle and false
otherwise.containsData
in interface HGStoreImplementation
public HGRandomAccessResult<HGPersistentHandle> getIncidenceResultSet(HGPersistentHandle handle)
HGStoreImplementation
getIncidenceResultSet
in interface HGStoreImplementation
public void removeIncidenceSet(HGPersistentHandle handle)
HGStoreImplementation
removeIncidenceSet
in interface HGStoreImplementation
public long getIncidenceSetCardinality(HGPersistentHandle handle)
HGStoreImplementation
getIncidenceSetCardinality
in interface HGStoreImplementation
public void addIncidenceLink(HGPersistentHandle handle, HGPersistentHandle newLink)
HGStoreImplementation
handle
parameter).addIncidenceLink
in interface HGStoreImplementation
public void removeIncidenceLink(HGPersistentHandle handle, HGPersistentHandle oldLink)
HGStoreImplementation
handle
parameter).removeIncidenceLink
in interface HGStoreImplementation
public <KeyType,ValueType> HGIndex<KeyType,ValueType> getIndex(String name)
HGStoreImplementation
null
if no
index with that name exists.getIndex
in interface HGStoreImplementation
public <KeyType,ValueType> HGIndex<KeyType,ValueType> getIndex(String name, ByteArrayConverter<KeyType> keyConverter, ByteArrayConverter<ValueType> valueConverter, Comparator<?> comparator, boolean isBidirectional, boolean createIfNecessary)
HGStoreImplementation
getIndex
in interface HGStoreImplementation
name
- 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)
HGStoreImplementation
removeIndex
in interface HGStoreImplementation
Copyright © 2015. All rights reserved.