Example #1
0
        /// <summary>
        /// Initializes the provider during silo startup.
        /// </summary>
        /// <param name="name">The name of this provider instance.</param>
        /// <param name="providerRuntime">A Orleans runtime object managing all storage providers.</param>
        /// <param name="config">Configuration info for this provider instance.</param>
        /// <returns>Completion promise for this operation.</returns>
        public override Task Init(string name, IProviderRuntime providerRuntime, IProviderConfiguration config)
        {
            this.Name = name;

            //Read config
            this.bucketName = config.Properties["BucketName"];
            var user     = config.Properties["UserName"];
            var password = config.Properties["Password"];
            var server   = config.Properties["Server"];

            //sanity check of config values
            if (string.IsNullOrWhiteSpace(bucketName))
            {
                throw new ArgumentException("BucketName property not set");
            }
            if (string.IsNullOrWhiteSpace(server))
            {
                throw new ArgumentException("Server property not set");
            }

            Couchbase.Configuration.Client.ClientConfiguration clientConfig = new Couchbase.Configuration.Client.ClientConfiguration();
            clientConfig.Servers.Clear();
            clientConfig.Servers.Add(new Uri(server));
            clientConfig.BucketConfigs.Clear();
            clientConfig.BucketConfigs.Add(bucketName, new Couchbase.Configuration.Client.BucketConfiguration
            {
                BucketName = this.bucketName,
                Username   = user,
                Password   = password
            });

            DataManager = new CouchBaseDataManager(bucketName, clientConfig);
            return(base.Init(name, providerRuntime, config));
        }
        /// <summary>
        /// Initializes the provider during silo startup.
        /// </summary>
        /// <param name="name">The name of this provider instance.</param>
        /// <param name="providerRuntime">A Orleans runtime object managing all storage providers.</param>
        /// <param name="config">Configuration info for this provider instance.</param>
        /// <returns>Completion promise for this operation.</returns>
        public override Task Init(string name, IProviderRuntime providerRuntime, IProviderConfiguration config)
        {
            this.Name = name;

            string storageBucketName   = null;
            var    clientConfiguration = config.Properties.ReadCouchbaseConfiguration(out storageBucketName);

            DataManager = new CouchBaseDataManager(storageBucketName, clientConfiguration);
            return(base.Init(name, providerRuntime, config));
        }
Example #3
0
        /// <summary>
        /// Initializes the provider during silo startup.
        /// </summary>
        /// <param name="name">The name of this provider instance.</param>
        /// <param name="providerRuntime">A Orleans runtime object managing all storage providers.</param>
        /// <param name="config">Configuration info for this provider instance.</param>
        /// <returns>Completion promise for this operation.</returns>
        public override Task Init(string name, IProviderRuntime providerRuntime, IProviderConfiguration config)
        {
            this.Name = name;

            string storageBucketName   = null;
            var    clientConfiguration = config.Properties.ReadCouchbaseConfiguration(out storageBucketName);

            var documentExpiries = CouchbaseOrleansConfigurationExtensions.GetGrainExpiries();

            DataManager = new CouchBaseDataManager(storageBucketName, clientConfiguration, documentExpiries);
            return(base.Init(name, providerRuntime, config));
        }