Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 private ConstraintRule AssertConstraintRule(SchemaRule schemaRule)
 {
     if (!(schemaRule is ConstraintRule))
     {
         fail("Expected ConstraintRule, but got " + schemaRule.GetType().Name);
     }
     return(( ConstraintRule )schemaRule);
 }
Ejemplo n.º 3
0
 private StoreIndexDescriptor AssertIndexRule(SchemaRule schemaRule)
 {
     if (!(schemaRule is StoreIndexDescriptor))
     {
         fail("Expected IndexRule, but got " + schemaRule.GetType().Name);
     }
     return(( StoreIndexDescriptor )schemaRule);
 }
Ejemplo n.º 4
0
        // 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());
        }
Ejemplo n.º 5
0
        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)));
        }
Ejemplo n.º 6
0
 public override void AddSchemaRule(SchemaRule rule)
 {
     _schemaCache.addSchemaRule(rule);
 }