Beispiel #1
0
 public virtual void Load(IEnumerable <SchemaRule> rules)
 {
     _cacheUpdateLock.@lock();
     try
     {
         ConstraintSemantics constraintSemantics = _schemaCacheState.constraintSemantics;
         this._schemaCacheState = new SchemaCacheState(constraintSemantics, rules, _indexProviderMap);
     }
     finally
     {
         _cacheUpdateLock.unlock();
     }
 }
Beispiel #2
0
 public virtual void RemoveSchemaRule(long id)
 {
     _cacheUpdateLock.@lock();
     try
     {
         SchemaCacheState updatedSchemaState = new SchemaCacheState(_schemaCacheState);
         updatedSchemaState.RemoveSchemaRule(id);
         this._schemaCacheState = updatedSchemaState;
     }
     finally
     {
         _cacheUpdateLock.unlock();
     }
 }
Beispiel #3
0
 public virtual void AddSchemaRule(SchemaRule rule)
 {
     _cacheUpdateLock.@lock();
     try
     {
         SchemaCacheState updatedSchemaState = new SchemaCacheState(_schemaCacheState);
         updatedSchemaState.AddSchemaRule(rule);
         this._schemaCacheState = updatedSchemaState;
     }
     finally
     {
         _cacheUpdateLock.unlock();
     }
 }
Beispiel #4
0
            internal SchemaCacheState(SchemaCacheState schemaCacheState)
            {
                this.ConstraintSemantics = schemaCacheState.ConstraintSemantics;
                this.IndexDescriptorById = LongObjectHashMap.newMap(schemaCacheState.IndexDescriptorById);
                this.ConstraintRuleById  = LongObjectHashMap.newMap(schemaCacheState.ConstraintRuleById);
                this.ConstraintsConflict = new HashSet <ConstraintDescriptor>(schemaCacheState.ConstraintsConflict);

                this.IndexDescriptorsConflict = new Dictionary <SchemaDescriptor, CapableIndexDescriptor>(schemaCacheState.IndexDescriptorsConflict);
                this.IndexDescriptorsByLabel  = new IntObjectHashMap <ISet <CapableIndexDescriptor> >(schemaCacheState.IndexDescriptorsByLabel.size());
                schemaCacheState.IndexDescriptorsByLabel.forEachKeyValue((k, v) => IndexDescriptorsByLabel.put(k, new HashSet <>(v)));
                this.IndexDescriptorsByRelationshipType = new IntObjectHashMap <ISet <CapableIndexDescriptor> >(schemaCacheState.IndexDescriptorsByRelationshipType.size());
                schemaCacheState.IndexDescriptorsByRelationshipType.forEachKeyValue((k, v) => IndexDescriptorsByRelationshipType.put(k, new HashSet <>(v)));
                this.IndexDescriptorsByName = new Dictionary <string, CapableIndexDescriptor>(schemaCacheState.IndexDescriptorsByName);
                this.DependantState         = new ConcurrentDictionary <Type, object>();
                this.IndexByProperty        = new IntObjectHashMap <IList <CapableIndexDescriptor> >(schemaCacheState.IndexByProperty.size());
                schemaCacheState.IndexByProperty.forEachKeyValue((k, v) => IndexByProperty.put(k, new List <>(v)));
                this.IndexProviderMap = schemaCacheState.IndexProviderMap;
            }
Beispiel #5
0
 /// <summary>
 /// Snapshot constructor. This is only used by the <seealso cref="snapshot()"/> method.
 /// </summary>
 private SchemaCache(SchemaCacheState schemaCacheState)
 {
     this._cacheUpdateLock  = new InaccessibleLock("Schema cache snapshots are read-only.");
     this._indexProviderMap = null;
     this._schemaCacheState = schemaCacheState;
 }
Beispiel #6
0
 public SchemaCache(ConstraintSemantics constraintSemantics, IEnumerable <SchemaRule> initialRules, IndexProviderMap indexProviderMap)
 {
     this._cacheUpdateLock  = (new StampedLock()).asWriteLock();
     this._indexProviderMap = indexProviderMap;
     this._schemaCacheState = new SchemaCacheState(constraintSemantics, initialRules, indexProviderMap);
 }