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 Label |
KEYSPACE_ENTITY |
static Label |
KEYSPACE_RESOURCE |
static String |
SYSTEM_GRAPH_NAME |
| Constructor and Description |
|---|
SystemKeyspace(EngineGraknGraphFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKeyspace(String keyspace)
Checks if the keyspace exists in the system.
|
boolean |
deleteKeyspace(String keyspace)
This is called when a graph is deleted via
GraknAdmin.delete(). |
boolean |
ensureKeyspaceInitialised(String keyspace)
Notify that we just opened a keyspace with the same engineUrl & config.
|
public static final String SYSTEM_GRAPH_NAME
public static final Label KEYSPACE_ENTITY
public static final Label KEYSPACE_RESOURCE
public SystemKeyspace(EngineGraknGraphFactory factory)
public boolean ensureKeyspaceInitialised(String keyspace)
public boolean containsKeyspace(String keyspace)
keyspace - The keyspace which might be in the systempublic boolean 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.