Esempio n. 1
0
 /// <summary>
 /// Creates a new instance if the currentInstance is not valid for the given Cassandra version
 /// </summary>
 public ISchemaParser Create(Version cassandraVersion, Metadata parent,
                             Func <string, string, Task <UdtColumnInfo> > udtResolver,
                             ISchemaParser currentInstance = null)
 {
     if (cassandraVersion >= Version40 && !(currentInstance is SchemaParserV3))
     {
         return(new SchemaParserV3(parent, udtResolver));
     }
     if (cassandraVersion >= Version30 && !(currentInstance is SchemaParserV2))
     {
         return(new SchemaParserV2(parent, udtResolver));
     }
     if (cassandraVersion < Version30 && !(currentInstance is SchemaParserV1))
     {
         return(new SchemaParserV1(parent));
     }
     if (currentInstance == null)
     {
         throw new ArgumentNullException(nameof(currentInstance));
     }
     return(currentInstance);
 }
 public CosmeticItemIconFunction(ISchemaParser schemaParser)
 {
     this.schemaParser = schemaParser;
 }
Esempio n. 3
0
 /// <summary>
 /// Sets the Cassandra version in order to identify how to parse the metadata information
 /// </summary>
 /// <param name="version"></param>
 internal void SetCassandraVersion(Version version)
 {
     _schemaParser = Configuration.SchemaParserFactory.Create(version, this, GetUdtDefinitionAsync, _schemaParser);
 }
        public ISchemaParser Create(
            Version cassandraVersion, Metadata parent, Func <string, string, Task <UdtColumnInfo> > udtResolver, ISchemaParser currentInstance = null)
        {
            var keyspaces = new ConcurrentDictionary <string, KeyspaceMetadata>();

            // unique configurations
            keyspaces.AddOrUpdate("ks1", FakeSchemaParserFactory.CreateSimpleKeyspace("ks1", 2), (s, keyspaceMetadata) => keyspaceMetadata);
            keyspaces.AddOrUpdate("ks4", FakeSchemaParserFactory.CreateNetworkTopologyKeyspace("ks4", new Dictionary <string, int> {
                { "dc1", 2 }, { "dc2", 2 }
            }), (s, keyspaceMetadata) => keyspaceMetadata);

            return(new FakeSchemaParser(keyspaces));
        }
Esempio n. 5
0
 internal Metadata(Configuration configuration, SchemaParser schemaParser) : this(configuration)
 {
     _schemaParser = schemaParser;
 }