public class SystemKeyspace extends Object
Manages the system keyspace.
Used to populate the system ontology the first time the system keyspace is created.
Used to populate the system keyspace with all newly create keyspaces as a user opens them. We have no way to determining whether a keyspace with a given name already exists or not. We maintain the list in our Grakn system keyspace. An element is added to that list when there is an attempt to create a graph from a factory bound to the keyspace name. The list is simply the instances of the system entity type 'keyspace'. Nothing is ever removed from that list. The set of known keyspaces is maintained in a static map so we don't connect to the system keyspace every time a factory produces a new graph. That means that we can't have several different factories (e.g. Titan and in-memory Tinkerpop) at the same time sharing keyspace names. We can't identify the factory builder by engineUrl and config because we don't know what's inside the config, which is residing remotely at the engine!
| Modifier and Type | Field and Description |
|---|---|
static TypeLabel |
KEYSPACE_ENTITY |
static TypeLabel |
KEYSPACE_RESOURCE |
protected static org.slf4j.Logger |
LOG |
static String |
SYSTEM_GRAPH_NAME |
| Modifier and Type | Method and Description |
|---|---|
static void |
close()
Closes the system keyspace if there are no pending transactions on it.
|
static boolean |
containsKeyspace(String keyspace)
Checks if the keyspace exists in the system.
|
static void |
deleteKeyspace(String keyspace)
This is called when a graph is deleted via
GraknAdmin.delete(). |
static void |
initialise(String engineUrl,
Properties properties)
Initialises the system keyspace for a specific running instance of engine
|
public static final String SYSTEM_GRAPH_NAME
public static final TypeLabel KEYSPACE_ENTITY
public static final TypeLabel KEYSPACE_RESOURCE
protected static final org.slf4j.Logger LOG
public static void initialise(String engineUrl, Properties properties)
engineUrl - the url of engine to get the config fromproperties - the properties used to initialise the keyspacepublic static void close()
public static boolean containsKeyspace(String keyspace)
keyspace - The keyspace which might be in the systempublic static void deleteKeyspace(String keyspace)
GraknAdmin.delete().
This removes the keyspace of the deleted graph from the system graphkeyspace - the keyspace to be removed from the system graphCopyright © 2017 Grakn Labs Ltd. All rights reserved.