Skip to content

Commit 494b47d

Browse files
init commit
1 parent 44be7d0 commit 494b47d

19 files changed

+235
-15
lines changed

src/Ydb.Sdk/src/Pool/ChannelPool.cs renamed to src/Ydb.Sdk/src/Ado/Pool/ChannelPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Grpc.Net.Client;
77
using Microsoft.Extensions.Logging;
88

9-
namespace Ydb.Sdk.Pool;
9+
namespace Ydb.Sdk.Ado.Pool;
1010

1111
internal class ChannelPool<T> : IAsyncDisposable where T : ChannelBase, IDisposable
1212
{

src/Ydb.Sdk/src/Pool/EndpointPool.cs renamed to src/Ydb.Sdk/src/Ado/Pool/EndpointPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Immutable;
22
using Microsoft.Extensions.Logging;
33

4-
namespace Ydb.Sdk.Pool;
4+
namespace Ydb.Sdk.Ado.Pool;
55

66
internal class EndpointPool
77
{
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Ydb.Sdk.Ado.Pool;
2+
3+
public class SessionPool
4+
{
5+
6+
}

src/Ydb.Sdk/src/Ado/PoolManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal static class PoolManager
99
private static readonly SemaphoreSlim SemaphoreSlim = new(1); // async mutex
1010
private static readonly ConcurrentDictionary<string, SessionPool> Pools = new();
1111

12-
internal static async Task<Session> GetSession(
12+
internal static async Task<Services.Query.Session> GetSession(
1313
YdbConnectionStringBuilder connectionString,
1414
CancellationToken cancellationToken
1515
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Ydb.Query;
2+
using Ydb.Sdk.Services.Query;
3+
using Ydb.Sdk.Value;
4+
5+
namespace Ydb.Sdk.Ado.Session;
6+
7+
internal interface IAdoSession
8+
{
9+
internal ValueTask<IServerStream<ExecuteQueryResponsePart>> ExecuteQuery(
10+
string query,
11+
Dictionary<string, YdbValue>? parameters,
12+
ExecuteQuerySettings? settings,
13+
TransactionControl? txControl
14+
);
15+
16+
17+
}

src/Ydb.Sdk/src/Ado/YdbConnection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private YdbConnectionStringBuilder ConnectionStringBuilder
2424
[param: AllowNull] init => _connectionStringBuilder = value;
2525
}
2626

27-
internal Session Session
27+
internal Services.Query.Session Session
2828
{
2929
get
3030
{
@@ -35,7 +35,7 @@ internal Session Session
3535
private set => _session = value;
3636
}
3737

38-
private Session _session = null!;
38+
private Services.Query.Session _session = null!;
3939

4040
public YdbConnection()
4141
{

src/Ydb.Sdk/src/Ado/YdbConnectionStringBuilder.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Security.Cryptography.X509Certificates;
44
using Microsoft.Extensions.Logging;
55
using Microsoft.Extensions.Logging.Abstractions;
6+
using Ydb.Sdk.Ado.Internal;
67
using Ydb.Sdk.Auth;
78
using Ydb.Sdk.Pool;
89
using Ydb.Sdk.Transport;
@@ -29,6 +30,8 @@ private void InitDefaultValues()
2930
_port = YdbAdoDefaultSettings.Port;
3031
_database = YdbAdoDefaultSettings.Database;
3132
_maxSessionPool = SessionPoolDefaultSettings.MaxSessionPool;
33+
_minSessionPool = 0;
34+
_sessionIdleTimeout = 300;
3235
_useTls = YdbAdoDefaultSettings.UseTls;
3336
_connectTimeout = GrpcDefaultSettings.ConnectTimeoutSeconds;
3437
_keepAlivePingDelay = GrpcDefaultSettings.KeepAlivePingSeconds;
@@ -123,6 +126,40 @@ public int MaxSessionPool
123126

124127
private int _maxSessionPool;
125128

129+
public int MinSessionPool
130+
{
131+
get => _minSessionPool;
132+
set
133+
{
134+
if (value <= 0)
135+
{
136+
throw new ArgumentOutOfRangeException(nameof(value), value, "Invalid min session pool: " + value);
137+
}
138+
139+
_minSessionPool = value;
140+
SaveValue(nameof(MinSessionPool), value);
141+
}
142+
}
143+
144+
private int _minSessionPool;
145+
146+
public int SessionIdleTimeout
147+
{
148+
get => _sessionIdleTimeout;
149+
set
150+
{
151+
if (value < 0)
152+
{
153+
throw new ArgumentOutOfRangeException(nameof(value), value, "Invalid session idle timeout: " + value);
154+
}
155+
156+
_sessionIdleTimeout = value;
157+
SaveValue(nameof(SessionIdleTimeout), value);
158+
}
159+
}
160+
161+
private int _sessionIdleTimeout;
162+
126163
public bool UseTls
127164
{
128165
get => _useTls;

src/Ydb.Sdk/src/Driver.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
using Ydb.Discovery;
66
using Ydb.Discovery.V1;
77
using Ydb.Sdk.Ado;
8-
using Ydb.Sdk.Ado.Internal;
9-
using Ydb.Sdk.Pool;
8+
using Ydb.Sdk.Ado.Pool;
109

1110
namespace Ydb.Sdk;
1211

src/Ydb.Sdk/src/IDriver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Grpc.Core;
22
using Grpc.Net.Client;
33
using Microsoft.Extensions.Logging;
4+
using Ydb.Sdk.Ado.Pool;
45
using Ydb.Sdk.Ado;
56
using Ydb.Sdk.Auth;
6-
using Ydb.Sdk.Pool;
77
using Ydb.Sdk.Services.Auth;
88

99
namespace Ydb.Sdk;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Runtime.CompilerServices;
22

33
[assembly: InternalsVisibleTo("EntityFrameworkCore.Ydb")]
4+
[assembly: InternalsVisibleTo("Ydb.Sdk.Ado.Benchmarks")]
45
[assembly: InternalsVisibleTo("Ydb.Sdk.Ado.Tests")]
56
[assembly: InternalsVisibleTo("Ydb.Sdk.Topic.Tests")]

0 commit comments

Comments
 (0)