public class TxCache extends Object
Tracks Transaction Specific Variables
Caches Transaction specific data this includes:
Label - Allows mapping type labels to type Ids| Constructor and Description |
|---|
TxCache(GlobalCache globalCache) |
| Modifier and Type | Method and Description |
|---|---|
void |
addedInstance(ConceptId conceptId) |
void |
addNewAttribute(String index,
ConceptId conceptId) |
void |
addNewRelationship(Relationship relationship) |
void |
cacheConcept(Concept concept)
Caches a concept so it does not have to be rebuilt later.
|
void |
closeTx(String closedReason) |
LabelId |
convertLabelToId(Label label) |
<X extends Concept> |
getCachedConcept(ConceptId id)
Returns a previously built concept
|
<X extends SchemaConcept> |
getCachedSchemaConcept(Label label)
Returns a previously built type
|
String |
getClosedReason() |
Set<Casting> |
getModifiedCastings() |
Set<RelationshipType> |
getModifiedRelationshipTypes() |
Set<Role> |
getModifiedRoles() |
Set<Rule> |
getModifiedRules() |
Set<Thing> |
getModifiedThings() |
Map<String,ConceptId> |
getNewAttributes() |
Set<Relationship> |
getNewRelationships() |
Map<ConceptId,Long> |
getShardingCount() |
boolean |
isConceptCached(ConceptId id)
Checks if the concept has been built before and is currently cached
|
boolean |
isLabelCached(Label label) |
boolean |
isTxOpen() |
boolean |
isTypeCached(Label label) |
void |
openTx(GraknTxType txType) |
void |
refreshSchemaCache()
Refreshes the transaction schema cache by reading the central schema cache is read into this transaction cache.
|
void |
remove(Casting casting) |
void |
remove(Concept concept) |
void |
removedInstance(ConceptId conceptId) |
void |
removeFromValidation(Type type) |
boolean |
schemaNotCached() |
void |
trackForValidation(Casting casting) |
void |
trackForValidation(Concept concept) |
GraknTxType |
txType() |
void |
writeOccurred()
Notifies the cache that a write has occurred.
|
void |
writeToGraphCache(boolean isSafe)
A helper method which writes back into the graph cache at the end of a transaction.
|
public TxCache(GlobalCache globalCache)
public void writeToGraphCache(boolean isSafe)
isSafe - true only if it is safe to copy the cache completely without any checkspublic void writeOccurred()
public boolean schemaNotCached()
public void refreshSchemaCache()
public void trackForValidation(Concept concept)
concept - The element to be later validatedpublic void trackForValidation(Casting casting)
public void removeFromValidation(Type type)
public Map<ConceptId,Long> getShardingCount()
public void remove(Concept concept)
concept - The concept to no longer trackpublic void remove(Casting casting)
public void cacheConcept(Concept concept)
concept - The concept to be cached.public boolean isConceptCached(ConceptId id)
id - The id of the conceptpublic boolean isTypeCached(Label label)
label - The label of the type to cachepublic boolean isLabelCached(Label label)
label - the type label which may be in the cachepublic <X extends Concept> X getCachedConcept(ConceptId id)
X - The type of the conceptid - The id of the conceptpublic <X extends SchemaConcept> X getCachedSchemaConcept(Label label)
X - The type of the typelabel - The label of the typepublic void addedInstance(ConceptId conceptId)
public void removedInstance(ConceptId conceptId)
public Set<RelationshipType> getModifiedRelationshipTypes()
public void addNewRelationship(Relationship relationship)
public Set<Relationship> getNewRelationships()
public void closeTx(String closedReason)
public void openTx(GraknTxType txType)
public boolean isTxOpen()
public GraknTxType txType()
public String getClosedReason()
Copyright © 2018 Grakn Labs Ltd. All rights reserved.