Exemple #1
0
 internal ConstraintRule(long id, ConstraintDescriptor descriptor, long?ownedIndex, string name)
 {
     this._id         = id;
     this._descriptor = descriptor;
     this._ownedIndex = ownedIndex;
     this._name       = SchemaRule.nameOrDefault(name, "constraint_" + id);
 }
 private ConstraintRule AssertConstraintRule(SchemaRule schemaRule)
 {
     if (!(schemaRule is ConstraintRule))
     {
         fail("Expected ConstraintRule, but got " + schemaRule.GetType().Name);
     }
     return(( ConstraintRule )schemaRule);
 }
 private StoreIndexDescriptor AssertIndexRule(SchemaRule schemaRule)
 {
     if (!(schemaRule is StoreIndexDescriptor))
     {
         fail("Expected IndexRule, but got " + schemaRule.GetType().Name);
     }
     return(( StoreIndexDescriptor )schemaRule);
 }
        // PUBLIC

        /// <summary>
        /// Serialize the provided SchemaRule onto the target buffer
        /// </summary>
        /// <param name="schemaRule"> the SchemaRule to serialize </param>
        public static sbyte[] Serialize(SchemaRule schemaRule)
        {
            if (schemaRule is StoreIndexDescriptor)
            {
                return(Serialize(( StoreIndexDescriptor )schemaRule));
            }
            else if (schemaRule is ConstraintRule)
            {
                return(Serialize(( ConstraintRule )schemaRule));
            }
            throw new System.InvalidOperationException("Unknown schema rule type: " + schemaRule.GetType());
        }
        private SchemaRecord Serialize(SchemaRule rule, long id, bool inUse, bool created)
        {
            DynamicRecord record = new DynamicRecord(id);

            record.Data = SchemaRuleSerialization.serialize(rule);
            if (created)
            {
                record.SetCreated();
            }
            if (inUse)
            {
                record.InUse = true;
            }
            return(new SchemaRecord(singletonList(record)));
        }
Exemple #6
0
 public override void AddSchemaRule(SchemaRule rule)
 {
     _schemaCache.addSchemaRule(rule);
 }