Represents the configuration of a DseCluster.
Example #1
0
 internal DseCluster(ICluster coreCluster, DseConfiguration config)
 {
     _coreCluster = coreCluster;
     _config = config;
     _coreCluster.HostAdded += OnCoreHostAdded;
     _coreCluster.HostRemoved += OnCoreHostRemoved;
 }
Example #2
0
        /// <summary>
        /// Builds the cluster with the configured set of initial contact points and policies.
        /// </summary>
        /// <returns>
        /// A new <see cref="DseCluster"/> instance.
        /// </returns>
        public new DseCluster Build()
        {
            var dseAssembly       = typeof(DseCluster).GetTypeInfo().Assembly;
            var cassandraAssembly = typeof(ISession).GetTypeInfo().Assembly;

            Logger.Info("Using DataStax C# DSE driver v{0} (core driver v{1})",
                        FileVersionInfo.GetVersionInfo(dseAssembly.Location).FileVersion,
                        FileVersionInfo.GetVersionInfo(cassandraAssembly.Location).FileVersion);
            var typeSerializerDefinitions = _typeSerializerDefinitions ?? new TypeSerializerDefinitions();

            typeSerializerDefinitions
            .Define(new DateRangeSerializer())
            .Define(new DurationSerializer(true))
            .Define(new LineStringSerializer())
            .Define(new PointSerializer())
            .Define(new PolygonSerializer());

            base.WithTypeSerializers(typeSerializerDefinitions);
            var coreCluster = base.Build();
            var config      = new DseConfiguration(coreCluster.Configuration, GraphOptions ?? new GraphOptions());

            // To be replaced after CSHARP-444.
            config.AddressTranslator = _addressTranslator;
            return(new DseCluster(
                       coreCluster,
                       config));
        }
 internal DseCluster(ICluster coreCluster, DseConfiguration config)
 {
     _coreCluster              = coreCluster;
     _config                   = config;
     _coreCluster.HostAdded   += OnCoreHostAdded;
     _coreCluster.HostRemoved += OnCoreHostRemoved;
 }
Example #4
0
 public DseSession(ISession coreSession, DseConfiguration config)
 {
     if (coreSession == null)
     {
         throw new ArgumentNullException("coreSession");
     }
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     _coreSession = coreSession;
     _config      = config;
 }
Example #5
0
 public DseSession(ISession coreSession, DseConfiguration config)
 {
     if (coreSession == null)
     {
         throw new ArgumentNullException("coreSession");
     }
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     _coreSession = coreSession;
     _config = config;
 }
 /// <summary>
 /// Builds the cluster with the configured set of initial contact points and policies.
 /// </summary>
 /// <returns>
 /// A new <see cref="DseCluster"/> instance.
 /// </returns>
 public new DseCluster Build()
 {
     var dseAssembly = Assembly.GetExecutingAssembly();
     var cassandraAssembly = typeof(ISession).Assembly;
     Logger.Info("Using DataStax C# DSE driver v{0} (core driver v{1})", 
         FileVersionInfo.GetVersionInfo(dseAssembly.Location).FileVersion,
         FileVersionInfo.GetVersionInfo(cassandraAssembly.Location).FileVersion);
     var typeSerializerDefinitions = _typeSerializerDefinitions ?? new TypeSerializerDefinitions();
     typeSerializerDefinitions
         .Define(new LineStringSerializer())
         .Define(new PointSerializer())
         .Define(new PolygonSerializer());
     base.WithTypeSerializers(typeSerializerDefinitions);
     var coreCluster = base.Build();
     var config = new DseConfiguration(coreCluster.Configuration, GraphOptions ?? new GraphOptions());
     // To be replaced after CSHARP-444.
     config.AddressTranslator = _addressTranslator;
     return new DseCluster(
         coreCluster, 
         config);
 }
Example #7
0
 internal DseSession(ISession coreSession, DseConfiguration config) : this(coreSession, coreSession.Cluster, config)
 {
 }