Esempio n. 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();
     }
 }
Esempio n. 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();
     }
 }
Esempio n. 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();
     }
 }
Esempio n. 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;
            }
Esempio n. 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;
 }
Esempio n. 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);
 }