public class SystemKeyspace extends Object
Manages the system keyspace.
Used to populate the system schema 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. Janus 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 ai.grakn.concept.Label |
KEYSPACE_ENTITY |
static ai.grakn.concept.Label |
KEYSPACE_RESOURCE |
static ai.grakn.Keyspace |
SYSTEM_KB_KEYSPACE |
| Constructor and Description |
|---|
SystemKeyspace(EngineGraknTxFactory factory) |
SystemKeyspace(EngineGraknTxFactory factory,
boolean loadSystemSchema) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKeyspace(ai.grakn.Keyspace keyspace)
Checks if the keyspace exists in the system.
|
boolean |
deleteKeyspace(ai.grakn.Keyspace keyspace)
This is called when a graph is deleted via
GraknAdmin.delete(). |
boolean |
ensureKeyspaceInitialised(ai.grakn.Keyspace keyspace)
Notify that we just opened a keyspace with the same engineUrl & config.
|
void |
loadSystemSchema()
Load the system schema into a newly created system keyspace.
|
public static final ai.grakn.Keyspace SYSTEM_KB_KEYSPACE
public static final ai.grakn.concept.Label KEYSPACE_ENTITY
public static final ai.grakn.concept.Label KEYSPACE_RESOURCE
public SystemKeyspace(EngineGraknTxFactory factory)
public SystemKeyspace(EngineGraknTxFactory factory, boolean loadSystemSchema)
public boolean ensureKeyspaceInitialised(ai.grakn.Keyspace keyspace)
public boolean containsKeyspace(ai.grakn.Keyspace keyspace)
keyspace - The Keyspace which might be in the systempublic boolean deleteKeyspace(ai.grakn.Keyspace keyspace)
GraknAdmin.delete().
This removes the keyspace of the deleted graph from the system graphkeyspace - the Keyspace to be removed from the system graphpublic void loadSystemSchema()
Copyright © 2017 Grakn Labs Ltd. All rights reserved.