Package uk.gov.gchq.gaffer.accumulostore
Class AccumuloStore
- java.lang.Object
-
- uk.gov.gchq.gaffer.store.Store
-
- uk.gov.gchq.gaffer.accumulostore.AccumuloStore
-
- Direct Known Subclasses:
SingleUseAccumuloStore
public class AccumuloStore extends Store
An Accumulo Implementation of the Gaffer Framework
The key detail of the Accumulo implementation is that any Edge inserted by a user is inserted into the accumulo table twice, once with the source object being put first in the key and once with the destination being put first in the key. This is to enable an edge to be found in a Range scan when providing only one end of the edge.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FAILED_TO_CREATE_AN_ACCUMULO_FROM_ELEMENT_OF_TYPE_WHEN_TRYING_TO_INSERT_ELEMENTS
static Set<StoreTrait>
TRAITS
-
Constructor Summary
Constructors Constructor Description AccumuloStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElements(Iterable<? extends Element> elements)
Method to addElement
s into Accumulo.void
deleteElements(Iterable<? extends Element> elements)
Method to deleteElement
s from Accumulo.org.apache.accumulo.core.client.Connector
getConnection()
Creates an AccumuloConnector
using the properties found in properties file associated with the AccumuloStore.String
getCreatedTime()
Retrieves Accumulo Table created time property.AccumuloKeyPackage
getKeyPackage()
Gets theAccumuloKeyPackage
in use by this AccumuloStore.AccumuloProperties
getProperties()
Gets allAccumuloProperties
related to the store.String
getTableName()
Gets the name of the Accumulo table backing this storeList<String>
getTabletServers()
Gets the TabletServers.void
initialise(String graphId, Schema schema, StoreProperties properties)
void
preInitialise(String graphId, Schema schema, StoreProperties properties)
Performs general initialisation without creating the table.void
updateConfiguration(org.apache.hadoop.conf.Configuration conf, GraphFilters graphFilters, User user)
Updates a HadoopConfiguration
with information needed to connect to the Accumulo store.void
validateSchemas()
-
Methods inherited from class uk.gov.gchq.gaffer.store.Store
addOperationChainOptimisers, addOperationHandler, addOperationHandler, createContext, createStore, createStore, execute, execute, executeJob, executeJob, getCaches, getGraphId, getGraphLibrary, getJobTracker, getNextOperations, getOperationChainOptimisers, getOperationChainValidator, getOperationHandler, getOriginalSchema, getSchema, getSupportedOperations, handleOperation, isSupported, optimiseSchema, populateElement, runAsync, setGraphLibrary, setOriginalSchema, updateJsonSerialiser, updateJsonSerialiser
-
-
-
-
Field Detail
-
TRAITS
public static final Set<StoreTrait> TRAITS
-
FAILED_TO_CREATE_AN_ACCUMULO_FROM_ELEMENT_OF_TYPE_WHEN_TRYING_TO_INSERT_ELEMENTS
public static final String FAILED_TO_CREATE_AN_ACCUMULO_FROM_ELEMENT_OF_TYPE_WHEN_TRYING_TO_INSERT_ELEMENTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialise
public void initialise(String graphId, Schema schema, StoreProperties properties) throws StoreException
- Overrides:
initialise
in classStore
- Throws:
StoreException
-
getCreatedTime
public String getCreatedTime()
Retrieves Accumulo Table created time property.- Overrides:
getCreatedTime
in classStore
- Returns:
- Accumulo Table created time string.
-
preInitialise
public void preInitialise(String graphId, Schema schema, StoreProperties properties) throws StoreException
Performs general initialisation without creating the table.- Parameters:
graphId
- The graph ID.schema
- The Gaffer Schema.properties
- The Accumulo store properties.- Throws:
StoreException
- If the store could not be initialised.
-
getConnection
public org.apache.accumulo.core.client.Connector getConnection() throws StoreException
Creates an AccumuloConnector
using the properties found in properties file associated with the AccumuloStore.- Returns:
- A new
Connector
. - Throws:
StoreException
- If there is a failure to connect to accumulo.
-
getTableName
public String getTableName()
Gets the name of the Accumulo table backing this store- Returns:
- Accumulo Table Name
-
updateConfiguration
public void updateConfiguration(org.apache.hadoop.conf.Configuration conf, GraphFilters graphFilters, User user) throws StoreException
Updates a HadoopConfiguration
with information needed to connect to the Accumulo store. It adds iterators to apply the providedView
. This method will be used by operations that run MapReduce or Spark jobs against the Accumulo store.- Parameters:
conf
- AConfiguration
to be updated.graphFilters
- The operationGraphFilters
to be applied.user
- TheUser
to be used.- Throws:
StoreException
- If there is a failure to connect to Accumulo or a problem setting the iterators.
-
validateSchemas
public void validateSchemas()
- Overrides:
validateSchemas
in classStore
-
getProperties
public AccumuloProperties getProperties()
Gets allAccumuloProperties
related to the store.- Overrides:
getProperties
in classStore
- Returns:
AccumuloProperties
.
-
addElements
public void addElements(Iterable<? extends Element> elements) throws StoreException
Method to addElement
s into Accumulo.- Parameters:
elements
- The elements to be added.- Throws:
StoreException
- If there is a failure to insert the elements into a table.
-
deleteElements
public void deleteElements(Iterable<? extends Element> elements) throws StoreException
Method to deleteElement
s from Accumulo.- Parameters:
elements
- The elements to be deleted.- Throws:
StoreException
- If there is a failure to delete elements.
-
getKeyPackage
public AccumuloKeyPackage getKeyPackage()
Gets theAccumuloKeyPackage
in use by this AccumuloStore.- Returns:
AccumuloKeyPackage
.
-
getTabletServers
public List<String> getTabletServers() throws StoreException
Gets the TabletServers.- Returns:
- A list of Strings of TabletServers.
- Throws:
StoreException
- If failure.
-
-