Skip to content

Commit 10f68a6

Browse files
committed
Options rename
1 parent 28c806e commit 10f68a6

File tree

8 files changed

+15
-20
lines changed

8 files changed

+15
-20
lines changed

CanalSharp.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "props", "props", "{D21B3144
2525
build\version.props = build\version.props
2626
EndProjectSection
2727
EndProject
28-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CanalSharp.SimpleApp", "sample\CanalSharp.SimpleApp\CanalSharp.SimpleApp.csproj", "{BDFF31D3-BA2D-4B67-A805-E864A79A04AD}"
28+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CanalSharp.SimpleApp", "sample\CanalSharp.SimpleApp\CanalSharp.SimpleApp.csproj", "{BDFF31D3-BA2D-4B67-A805-E864A79A04AD}"
2929
EndProject
3030
Global
3131
GlobalSection(SolutionConfigurationPlatforms) = preSolution

sample/CanalSharp.SimpleApp/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ static async Task ClusterConn()
2727
.AddConsole();
2828
});
2929
_logger = loggerFactory.CreateLogger<Program>();
30-
var conn = new ClusterCanalConnection(
31-
new ClusterCanalConnectionOptions("localhost:2181", "12350") { UserName = "canal", Password = "canal" },
30+
var conn = new ClusterCanalConnection( new ClusterCanalOptions("localhost:2181", "12350") { UserName = "canal", Password = "canal" },
3231
loggerFactory);
3332
await conn.ConnectAsync();
3433
await conn.SubscribeAsync();
@@ -59,7 +58,7 @@ static async Task SimpleConn()
5958
.AddConsole();
6059
});
6160
_logger = loggerFactory.CreateLogger<Program>();
62-
var conn = new SimpleCanalConnection(new SimpleCanalConnectionOptions("127.0.0.1", 11111, "12349") { UserName = "canal", Password = "canal" }, loggerFactory.CreateLogger<SimpleCanalConnection>());
61+
var conn = new SimpleCanalConnection(new SimpleCanalOptions("127.0.0.1", 11111, "12349") { UserName = "canal", Password = "canal" }, loggerFactory.CreateLogger<SimpleCanalConnection>());
6362
await conn.ConnectAsync();
6463
await conn.SubscribeAsync();
6564
await conn.RollbackAsync(0);

src/CanalSharp/CanalSharp.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
3131
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
3232
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
33-
<!-- <PackageReference Include="NZookeeper" Version="0.1.0" /> -->
33+
<PackageReference Include="NZookeeper" Version="0.2.0" />
3434
</ItemGroup>
3535

3636
<ItemGroup>
@@ -40,8 +40,4 @@
4040
</None>
4141
</ItemGroup>
4242

43-
<ItemGroup>
44-
<ProjectReference Include="..\..\..\NZookeeper\src\NZookeeper\NZookeeper.csproj" />
45-
</ItemGroup>
46-
4743
</Project>

src/CanalSharp/Connections/CanalConnectionOptionsBase.cs renamed to src/CanalSharp/Connections/CanalOptionsBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace CanalSharp.Connections
22
{
3-
public class CanalConnectionOptionsBase
3+
public class CanalOptionsBase
44
{
55
/// <summary>
66
/// Canal Destination(Optional, default value is 'example')

src/CanalSharp/Connections/HA/ClusterCanalConnection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace CanalSharp.Connections
1616
/// </summary>
1717
public class ClusterCanalConnection : ICanalConnection
1818
{
19-
private readonly ClusterCanalConnectionOptions _options;
19+
private readonly ClusterCanalOptions _options;
2020
private readonly ILoggerFactory _loggerFactory;
2121
private readonly ILogger<ClusterCanalConnection> _logger;
2222
// ReSharper disable once InconsistentNaming
@@ -28,7 +28,7 @@ public class ClusterCanalConnection : ICanalConnection
2828
private SimpleCanalConnection _currentConn;
2929
private ZkConnection _zk;
3030

31-
public ClusterCanalConnection([NotNull] ClusterCanalConnectionOptions options, ILoggerFactory loggerFactory)
31+
public ClusterCanalConnection([NotNull] ClusterCanalOptions options, ILoggerFactory loggerFactory)
3232
{
3333
_options = options;
3434
_loggerFactory = loggerFactory;
@@ -202,10 +202,10 @@ public Task<Message> GetWithoutAckAsync(int fetchSize, long? timeout,
202202
return _currentConn.GetWithoutAckAsync(fetchSize, timeout);
203203
}
204204

205-
private SimpleCanalConnectionOptions CopyOptions(CanalRunningInfo runningInfo)
205+
private SimpleCanalOptions CopyOptions(CanalRunningInfo runningInfo)
206206
{
207207
var tmpArr = runningInfo.Address.Split(":");
208-
var op = new SimpleCanalConnectionOptions(tmpArr[0], int.Parse(tmpArr[1]), _options.ClientId)
208+
var op = new SimpleCanalOptions(tmpArr[0], int.Parse(tmpArr[1]), _options.ClientId)
209209
{
210210
Destination = _options.Destination,
211211
IdleTimeout = _options.IdleTimeout,

src/CanalSharp/Connections/HA/ClusterCanalConnectionOptions.cs renamed to src/CanalSharp/Connections/HA/ClusterCanalOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace CanalSharp.Connections
22
{
3-
public class ClusterCanalConnectionOptions : CanalConnectionOptionsBase
3+
public class ClusterCanalOptions : CanalOptionsBase
44
{
5-
public ClusterCanalConnectionOptions(string zkAddress, string clientId)
5+
public ClusterCanalOptions(string zkAddress, string clientId)
66
{
77
ClientId = clientId;
88
ZkAddress = zkAddress;

src/CanalSharp/Connections/Simple/SimpleCanalConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ namespace CanalSharp.Connections
1717
/// </summary>
1818
public class SimpleCanalConnection : ICanalConnection
1919
{
20-
private readonly SimpleCanalConnectionOptions _options;
20+
private readonly SimpleCanalOptions _options;
2121
private readonly ILogger _logger;
2222
private TcpClient _client;
2323

2424
public ConnectionState State { get; internal set; }
2525

26-
public SimpleCanalConnection([NotNull] SimpleCanalConnectionOptions options, ILogger<SimpleCanalConnection> logger)
26+
public SimpleCanalConnection([NotNull] SimpleCanalOptions options, ILogger<SimpleCanalConnection> logger)
2727
{
2828
Check.NotNull(options, nameof(options));
2929

src/CanalSharp/Connections/Simple/SimpleCanalConnectionOptions.cs renamed to src/CanalSharp/Connections/Simple/SimpleCanalOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace CanalSharp.Connections
22
{
3-
public class SimpleCanalConnectionOptions: CanalConnectionOptionsBase
3+
public class SimpleCanalOptions: CanalOptionsBase
44
{
5-
public SimpleCanalConnectionOptions(string host, int port, string clientId)
5+
public SimpleCanalOptions(string host, int port, string clientId)
66
{
77
Host = host;
88
Port = port;

0 commit comments

Comments
 (0)