これまでのところ、(古い)バージョンのCouchbaseから最新のバージョンにアップグレードすることには様々な理由があります。残念ながら、現在.NET用のCouchbase Client SDKのv1.1.6を使用しています。 v2.3.4への移行は現在、すべて設定を中心に、多くの急速な変更をもたらすようです。CouchbaseClientConfigurationからSDKのClientConfigurationへの移行
我々は(もBucketConfiguration
とPoolConfiguration
で)ClientConfiguration
で今取って代わられているように見える古いCouchbaseClientConfiguration
タイプを使用するために使用。私はほとんどの設定自体を移行することができましたが、現在は不明な点はタイムアウトです。
それがフックアップするために使用方法の例:
var clientConfiguration = new CouchbaseClientConfiguration()
{
Bucket = MembaseBucketName,
BucketPassword = MembaseBucketPassword
};
foreach (string host in root.Elements("servers").Elements("add").Attributes("uri"))
{
clientConfiguration.Servers.Add(new Uri(host));
}
// <servers retryCount="3" retryTimeout="00:00:30" >
clientConfiguration.RetryTimeout = TimeSpan.Parse(root.Element("servers").Attribute("retryTimeout").Value);
clientConfiguration.RetryCount = Convert.ToInt32(root.Element("servers").Attribute("retryCount").Value);
// <socketPool minPoolSize="10" maxPoolSize="10" connectionTimeout="00:00:30" deadTimeout="00:00:30" queueTimeout="00:00:30" receiveTimeout="00:00:30" />
clientConfiguration.SocketPool.MinPoolSize =
Convert.ToInt32(root.Element("socketPool").Attribute("minPoolSize").Value);
clientConfiguration.SocketPool.MaxPoolSize =
Convert.ToInt32(root.Element("socketPool").Attribute("maxPoolSize").Value);
clientConfiguration.SocketPool.ConnectionTimeout =
TimeSpan.Parse(root.Element("socketPool").Attribute("connectionTimeout").Value);
clientConfiguration.SocketPool.DeadTimeout =
TimeSpan.Parse(root.Element("socketPool").Attribute("deadTimeout").Value);
clientConfiguration.SocketPool.QueueTimeout =
TimeSpan.Parse(root.Element("socketPool").Attribute("queueTimeout").Value);
clientConfiguration.SocketPool.ReceiveTimeout =
TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value);
そして、これは私がこれまでに翻訳するために管理してきたものである:
var clientConfiguration = new ClientConfiguration
{
BucketConfigs = new Dictionary<string, BucketConfiguration>
{
{
MembaseBucketName,
new BucketConfiguration
{
BucketName = MembaseBucketName,
Password = MembaseBucketPassword,
Servers = root.Elements("servers").Elements("add").Attributes("uri").ToList(_ => new Uri(_.Value)),
PoolConfiguration = new PoolConfiguration
{
MinSize = Convert.ToInt32(root.Element("socketPool").Attribute("minPoolSize").Value),
MaxSize = Convert.ToInt32(root.Element("socketPool").Attribute("maxPoolSize").Value),
ConnectTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("connectionTimeout").Value).TotalMilliseconds,
WaitTimeout = (int)TimeSpan.Parse(root.Element("socketPool").Attribute("queueTimeout").Value).TotalMilliseconds,
},
DefaultOperationLifespan = (uint)TimeSpan.Parse(root.Element("socketPool").Attribute("receiveTimeout").Value).TotalMilliseconds,
}
},
},
};
は、私たちは、指定するために使用:QueueTimeout
、DeadTimeout
、 ReceiveTimeout
,ConnectionTimeout
,RetryTimeout
およびRetryCount
である。これらはどこに移行しますか?私は彼らが新しいコードで同等のプロパティを持っているか、またはそれらの周りのコンセプトが変更されていると思います。
また、Servers
とPoolConfiguration
の設定はどこにありますか?それらはClientConfiguration
とBucketConfiguration
で利用できます。少数のサーバーURIを使用して1つのバケットしか実行しないので、全体の構成は複雑ではありません。