The Map-store is a simple in-memory store. Any class that implements Java's Map interface can be used to store the data. If using a simple map implementation like HashMap, then data stored in this store is not persistent, i.e. when the JVM is shut down the data will disappear.
It is designed to support aggregation of properties efficiently. Optionally an index is maintained so that Elements can be found quickly from EntityIds or EdgeIds.
This is not currently designed to be a very high-performance, scalable in-memory store. Future versions of may include implementations that allow better scalability, for example by using off-heap storage. The current version stores the elements as objects in memory and so is not efficient in its memory usage.
Some examples of how this can be used are:
- As an in-memory cache of some data that has been retrieved from a larger store.
- For the aggregation of graph data within a streaming process.
- To demonstrate some of Gaffer's APIs.
It allows very quick calculation of the total number of elements in the graph subject to the default view.
Note that this store requires that the classes used for the vertices, and for all the group-by properties, have an implementation of the hashCode() method.
To configure your choice of Map implementation you can either:
- Set this "gaffer.store.mapstore.map.class" store property to be your chosen Map implementation class. This will require that java class to be on the classpath.
- For more complex Map implementation that require additional configuration and tuning you can use the "gaffer.store.mapstore.map.factory" map factory store property. This allows you to implement your own map factory to use different Map implementations like Hazelcast and MapDB. However due to the nature of having to query-update-put in order to add a new element other implementations may be slow. In addition you can provide you map factory with configuration using the "gaffer.store.mapstore.map.factory.config" store property.
This map store does not attempt to handle concurrent adding of elements. Elements should be added from a single thread.