Skip to content

Commit c29465a

Browse files
author
Roman Kozachenko
committed
Remove ITarantoolTuple restrictions
1 parent 7418706 commit c29465a

23 files changed

+40
-137
lines changed

.vscode/tasks.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
"isBuildCommand": true,
1313
"showOutput": "silent",
1414
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"taskName": "test",
18+
"args": [ "tests/progaudi.tarantool.tests/progaudi.tarantool.tests.csproj"],
19+
"isTestCommand": true,
20+
"showOutput": "silent",
21+
"problemMatcher": "$msCompile"
1522
}
1623
]
1724
}

src/progaudi.tarantool/Box.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,16 @@ public async Task Call_1_6(string functionName)
6969
}
7070

7171
public async Task Call_1_6<TTuple>(string functionName, TTuple parameters)
72-
where TTuple : ITarantoolTuple
7372
{
7473
await Call_1_6<TTuple, TarantoolTuple>(functionName, parameters).ConfigureAwait(false);
7574
}
7675

7776
public Task<DataResponse<TResponse[]>> Call_1_6<TResponse>(string functionName)
78-
where TResponse : ITarantoolTuple
7977
{
8078
return Call_1_6<TarantoolTuple, TResponse>(functionName, TarantoolTuple.Empty);
8179
}
8280

8381
public async Task<DataResponse<TResponse[]>> Call_1_6<TTuple, TResponse>(string functionName, TTuple parameters)
84-
where TTuple : ITarantoolTuple
85-
where TResponse : ITarantoolTuple
8682
{
8783
var callRequest = new CallRequest<TTuple>(functionName, parameters, false);
8884
return await _logicalConnection.SendRequest<CallRequest<TTuple>, TResponse>(callRequest).ConfigureAwait(false);
@@ -94,7 +90,6 @@ public async Task Call(string functionName)
9490
}
9591

9692
public async Task Call<TTuple>(string functionName, TTuple parameters)
97-
where TTuple : ITarantoolTuple
9893
{
9994
await Call<TTuple, TarantoolTuple>(functionName, parameters).ConfigureAwait(false);
10095
}
@@ -105,14 +100,12 @@ public Task<DataResponse<TResponse[]>> Call<TResponse>(string functionName)
105100
}
106101

107102
public async Task<DataResponse<TResponse[]>> Call<TTuple, TResponse>(string functionName, TTuple parameters)
108-
where TTuple : ITarantoolTuple
109103
{
110104
var callRequest = new CallRequest<TTuple>(functionName, parameters);
111105
return await _logicalConnection.SendRequest<CallRequest<TTuple>, TResponse>(callRequest).ConfigureAwait(false);
112106
}
113107

114108
public async Task<DataResponse<TResponse[]>> Eval<TTuple, TResponse>(string expression, TTuple parameters)
115-
where TTuple : ITarantoolTuple
116109
{
117110
var evalRequest = new EvalRequest<TTuple>(expression, parameters);
118111
return await _logicalConnection.SendRequest<EvalRequest<TTuple>, TResponse>(evalRequest).ConfigureAwait(false);

src/progaudi.tarantool/Converters/CallPacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class CallPacketConverter<T> : IMsgPackConverter<CallRequest<T>>
12-
where T : ITarantoolTuple
1312
{
1413
private IMsgPackConverter<Key> _keyConverter;
1514
private IMsgPackConverter<string> _stringConverter;

src/progaudi.tarantool/Converters/DeletePacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class DeletePacketConverter<T> : IMsgPackConverter<DeleteRequest<T>>
12-
where T: ITarantoolTuple
1312
{
1413
private IMsgPackConverter<Key> _keyConverter;
1514
private IMsgPackConverter<uint> _uintConverter;

src/progaudi.tarantool/Converters/EvalPacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class EvalPacketConverter<T> : IMsgPackConverter<EvalRequest<T>>
12-
where T:ITarantoolTuple
1312
{
1413
private IMsgPackConverter<Key> _keyConverter;
1514
private IMsgPackConverter<string> _stringConverter;

src/progaudi.tarantool/Converters/InsertReplacePacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class InsertReplacePacketConverter<T> : IMsgPackConverter<InsertReplaceRequest<T>>
12-
where T : ITarantoolTuple
1312
{
1413
private IMsgPackConverter<Key> _keyConverter;
1514
private IMsgPackConverter<uint> _uintConverter;

src/progaudi.tarantool/Converters/SelectPacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class SelectPacketConverter<T> : IMsgPackConverter<SelectRequest<T>>
12-
where T : ITarantoolTuple
1312
{
1413
private IMsgPackConverter<T> _selectKeyConverter;
1514
private IMsgPackConverter<Key> _keyConverter;

src/progaudi.tarantool/Converters/UpdatePacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class UpdatePacketConverter<T> : IMsgPackConverter<UpdateRequest<T>>
12-
where T : ITarantoolTuple
1312
{
1413
private IMsgPackConverter<uint> _uintConverter;
1514
private IMsgPackConverter<Key> _keyConverter;

src/progaudi.tarantool/Converters/UpsertPacketConverter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace ProGaudi.Tarantool.Client.Converters
1010
{
1111
internal class UpsertPacketConverter<T> : IMsgPackConverter<UpsertRequest<T>>
12-
where T : ITarantoolTuple
1312
{
1413
private IMsgPackConverter<uint> _uintConverter;
1514
private IMsgPackConverter<Key> _keyConverter;

src/progaudi.tarantool/IBox.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,21 @@ public interface IBox : IDisposable
1717

1818
Task Call_1_6(string functionName);
1919

20-
Task Call_1_6<TTuple>(string functionName, TTuple parameters)
21-
where TTuple : ITarantoolTuple;
20+
Task Call_1_6<TTuple>(string functionName, TTuple parameters);
2221

23-
Task<DataResponse<TResponse[]>> Call_1_6<TResponse>(string functionName)
24-
where TResponse : ITarantoolTuple;
22+
Task<DataResponse<TResponse[]>> Call_1_6<TResponse>(string functionName);
2523

26-
Task<DataResponse<TResponse[]>> Call_1_6<TTuple, TResponse>(string functionName, TTuple parameters)
27-
where TTuple : ITarantoolTuple
28-
where TResponse : ITarantoolTuple;
24+
Task<DataResponse<TResponse[]>> Call_1_6<TTuple, TResponse>(string functionName, TTuple parameters);
2925

3026
Task Call(string functionName);
3127

32-
Task Call<TTuple>(string functionName, TTuple parameters)
33-
where TTuple : ITarantoolTuple;
28+
Task Call<TTuple>(string functionName, TTuple parameters);
3429

3530
Task<DataResponse<TResponse[]>> Call<TResponse>(string functionName);
3631

37-
Task<DataResponse<TResponse[]>> Call<TTuple, TResponse>(string functionName, TTuple parameters)
38-
where TTuple : ITarantoolTuple;
32+
Task<DataResponse<TResponse[]>> Call<TTuple, TResponse>(string functionName, TTuple parameters);
3933

40-
Task<DataResponse<TResponse[]>> Eval<TTuple, TResponse>(string expression, TTuple parameters)
41-
where TTuple : ITarantoolTuple;
34+
Task<DataResponse<TResponse[]>> Eval<TTuple, TResponse>(string expression, TTuple parameters);
4235

4336
Task<DataResponse<TResponse[]>> Eval<TResponse>(string expression);
4437
}

src/progaudi.tarantool/IIndex.cs

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,35 @@ public interface IIndex
2323

2424
IReadOnlyList<IndexPart> Parts { get; }
2525

26-
Task<IEnumerable<TResult>> Pairs<TValue, TResult>(TValue value, Iterator iterator)
27-
where TResult : ITarantoolTuple;
26+
Task<IEnumerable<TResult>> Pairs<TValue, TResult>(TValue value, Iterator iterator);
2827

29-
Task<DataResponse<TTuple[]>> Select<TKey, TTuple>(TKey key, SelectOptions options = null)
30-
where TKey : ITarantoolTuple
31-
where TTuple : ITarantoolTuple;
28+
Task<DataResponse<TTuple[]>> Select<TKey, TTuple>(TKey key, SelectOptions options = null);
3229

3330
///Note: there is no such method in specification http://tarantool.org/doc/book/box/box_index.html.
3431
///But common sense, and sources https://github.com/tarantool/tarantool/blob/1.7/src/box/lua/index.c says that that method sould be
35-
Task<DataResponse<TTuple[]>> Insert<TTuple>(TTuple tuple)
36-
where TTuple : ITarantoolTuple;
32+
Task<DataResponse<TTuple[]>> Insert<TTuple>(TTuple tuple);
3733

3834
///Note: there is no such method in specification http://tarantool.org/doc/book/box/box_index.html.
3935
///But common sense, and sources https://github.com/tarantool/tarantool/blob/1.7/src/box/lua/index.c says that that method sould be
40-
Task<DataResponse<TTuple[]>> Replace<TTuple>(TTuple tuple)
41-
where TTuple : ITarantoolTuple;
36+
Task<DataResponse<TTuple[]>> Replace<TTuple>(TTuple tuple);
4237

43-
Task<TTuple> Min<TTuple>()
44-
where TTuple : ITarantoolTuple;
38+
Task<TTuple> Min<TTuple>();
4539

46-
Task<TTuple> Min<TTuple, TKey>(TKey key)
47-
where TTuple : ITarantoolTuple
48-
where TKey : class, ITarantoolTuple;
40+
Task<TTuple> Min<TTuple, TKey>(TKey key);
4941

50-
Task<TTuple> Max<TTuple>()
51-
where TTuple : ITarantoolTuple;
42+
Task<TTuple> Max<TTuple>();
5243

53-
Task<TTuple> Max<TTuple, TKey>(TKey key = null)
54-
where TTuple : ITarantoolTuple
55-
where TKey : class, ITarantoolTuple;
44+
Task<TTuple> Max<TTuple, TKey>(TKey key);
5645

57-
TTuple Random<TTuple>(int randomValue)
58-
where TTuple : ITarantoolTuple;
46+
TTuple Random<TTuple>(int randomValue);
5947

60-
uint Count<TKey>(TKey key = null, Iterator it = Iterator.Eq)
61-
where TKey : class, ITarantoolTuple;
48+
uint Count<TKey>(TKey key, Iterator it = Iterator.Eq);
6249

63-
Task<DataResponse<TTuple[]>> Update<TTuple, TKey>(TKey key, UpdateOperation[] updateOperations)
64-
where TKey : ITarantoolTuple
65-
where TTuple : ITarantoolTuple;
50+
Task<DataResponse<TTuple[]>> Update<TTuple, TKey>(TKey key, UpdateOperation[] updateOperations);
6651

67-
Task Upsert<TKey>(TKey key, UpdateOperation[] updateOperations)
68-
where TKey : ITarantoolTuple;
52+
Task Upsert<TKey>(TKey key, UpdateOperation[] updateOperations);
6953

70-
Task<DataResponse<TTuple[]>> Delete<TKey, TTuple>(TKey key)
71-
where TKey : ITarantoolTuple
72-
where TTuple : ITarantoolTuple;
54+
Task<DataResponse<TTuple[]>> Delete<TKey, TTuple>(TKey key);
7355

7456
Task Alter(IndexCreationOptions options);
7557

src/progaudi.tarantool/ISpace.cs

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,50 +33,31 @@ public interface ISpace
3333

3434
Task<IIndex> GetIndex(uint indexId);
3535

36-
Task<DataResponse<TTuple[]>> Insert<TTuple>(TTuple tuple)
37-
where TTuple : ITarantoolTuple;
36+
Task<DataResponse<TTuple[]>> Insert<TTuple>(TTuple tuple);
3837

39-
Task<DataResponse<TTuple[]>> Select<TKey, TTuple>(TKey selectKey)
40-
where TKey : ITarantoolTuple
41-
where TTuple : ITarantoolTuple;
38+
Task<DataResponse<TTuple[]>> Select<TKey, TTuple>(TKey selectKey);
4239

43-
Task<TTuple> Get<TKey, TTuple>(TKey key)
44-
where TKey : ITarantoolTuple
45-
where TTuple : ITarantoolTuple;
40+
Task<TTuple> Get<TKey, TTuple>(TKey key);
4641

47-
Task<DataResponse<TTuple[]>> Replace<TTuple>(TTuple tuple)
48-
where TTuple : ITarantoolTuple;
42+
Task<DataResponse<TTuple[]>> Replace<TTuple>(TTuple tuple);
4943

50-
Task<T> Put<T>(T tuple)
51-
where T : ITarantoolTuple;
44+
Task<T> Put<T>(T tuple);
5245

53-
Task<DataResponse<TTuple[]>> Update<TKey, TTuple>(TKey key, UpdateOperation[] updateOperations)
54-
where TKey : ITarantoolTuple
55-
where TTuple : ITarantoolTuple;
46+
Task<DataResponse<TTuple[]>> Update<TKey, TTuple>(TKey key, UpdateOperation[] updateOperations);
5647

57-
Task Upsert<TTuple>(TTuple tuple, UpdateOperation[] updateOperations)
58-
where TTuple : ITarantoolTuple;
48+
Task Upsert<TTuple>(TTuple tuple, UpdateOperation[] updateOperations);
5949

60-
Task<DataResponse<TTuple[]>> Delete<TKey, TTuple>(TKey key)
61-
where TTuple : ITarantoolTuple
62-
where TKey : ITarantoolTuple;
50+
Task<DataResponse<TTuple[]>> Delete<TKey, TTuple>(TKey key);
6351

64-
Task<uint> Count<TKey>(TKey key)
65-
where TKey : ITarantoolTuple;
52+
Task<uint> Count<TKey>(TKey key);
6653

6754
Task<uint> Length();
6855

69-
Task<DataResponse<TTuple[]>> Increment<TTuple, TKey>(TKey key)
70-
where TKey : ITarantoolTuple
71-
where TTuple : ITarantoolTuple;
56+
Task<DataResponse<TTuple[]>> Increment<TTuple, TKey>(TKey key);
7257

73-
Task<DataResponse<TTuple[]>> Decrement<TTuple, TKey>(TKey key)
74-
where TKey : ITarantoolTuple
75-
where TTuple : ITarantoolTuple;
58+
Task<DataResponse<TTuple[]>> Decrement<TTuple, TKey>(TKey key);
7659

77-
TTuple AutoIncrement<TTuple, TRest>(TRest tupleRest)
78-
where TTuple : ITarantoolTuple
79-
where TRest : ITarantoolTuple;
60+
TTuple AutoIncrement<TTuple, TRest>(TRest tupleRest);
8061

8162
Task<IEnumerable<KeyValuePair<TKey, TValue>>> Pairs<TKey, TValue>();
8263
}

src/progaudi.tarantool/Index.cs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,11 @@ public Index(uint id, uint spaceId, string name, bool unique, IndexType type, IR
3939
public IReadOnlyList<IndexPart> Parts { get; }
4040

4141
public Task<IEnumerable<TResult>> Pairs<TValue, TResult>(TValue value, Iterator iterator)
42-
where TResult : ITarantoolTuple
4342
{
4443
throw new NotImplementedException();
4544
}
4645

4746
public async Task<DataResponse<TTuple[]>> Select<TKey, TTuple>(TKey key, SelectOptions options = null)
48-
where TKey : ITarantoolTuple
49-
where TTuple : ITarantoolTuple
5047
{
5148
var selectRequest = new SelectRequest<TKey>(
5249
SpaceId,
@@ -62,7 +59,6 @@ public async Task<DataResponse<TTuple[]>> Select<TKey, TTuple>(TKey key, SelectO
6259
///Note: there is no such method in specification http://tarantool.org/doc/book/box/box_index.html.
6360
///But common sense, and sources https://github.com/tarantool/tarantool/blob/1.7/src/box/lua/index.c says that that method sould be
6461
public async Task<DataResponse<TTuple[]>> Insert<TTuple>(TTuple tuple)
65-
where TTuple : ITarantoolTuple
6662
{
6763
var insertRequest = new InsertRequest<TTuple>(SpaceId, tuple);
6864

@@ -72,22 +68,18 @@ public async Task<DataResponse<TTuple[]>> Insert<TTuple>(TTuple tuple)
7268
///Note: there is no such method in specification http://tarantool.org/doc/book/box/box_index.html.
7369
///But common sense, and sources https://github.com/tarantool/tarantool/blob/1.7/src/box/lua/index.c says that that method sould be
7470
public async Task<DataResponse<TTuple[]>> Replace<TTuple>(TTuple tuple)
75-
where TTuple : ITarantoolTuple
7671
{
7772
var replaceRequest = new ReplaceRequest<TTuple>(SpaceId, tuple);
7873

7974
return await LogicalConnection.SendRequest<InsertReplaceRequest<TTuple>, TTuple>(replaceRequest).ConfigureAwait(false);
8075
}
8176

8277
public async Task<TTuple> Min<TTuple>()
83-
where TTuple : ITarantoolTuple
8478
{
8579
return await Min<TTuple, TarantoolTuple>(TarantoolTuple.Empty).ConfigureAwait(false);
8680
}
8781

8882
public async Task<TTuple> Min<TTuple, TKey>(TKey key)
89-
where TTuple : ITarantoolTuple
90-
where TKey : class, ITarantoolTuple
9183
{
9284
if (Type != IndexType.Tree)
9385
{
@@ -102,14 +94,11 @@ public async Task<TTuple> Min<TTuple, TKey>(TKey key)
10294
}
10395

10496
public async Task<TTuple> Max<TTuple>()
105-
where TTuple : ITarantoolTuple
10697
{
10798
return await Max<TTuple, TarantoolTuple>(TarantoolTuple.Empty).ConfigureAwait(false);
10899
}
109100

110-
public async Task<TTuple> Max<TTuple, TKey>(TKey key = null)
111-
where TTuple : ITarantoolTuple
112-
where TKey : class, ITarantoolTuple
101+
public async Task<TTuple> Max<TTuple, TKey>(TKey key)
113102
{
114103
if (Type != IndexType.Tree)
115104
{
@@ -124,20 +113,16 @@ public async Task<TTuple> Max<TTuple, TKey>(TKey key = null)
124113
}
125114

126115
public TTuple Random<TTuple>(int randomValue)
127-
where TTuple : ITarantoolTuple
128116
{
129117
throw new NotImplementedException();
130118
}
131119

132-
public uint Count<TKey>(TKey key = null, Iterator it = Iterator.Eq)
133-
where TKey : class, ITarantoolTuple
120+
public uint Count<TKey>(TKey key, Iterator it = Iterator.Eq)
134121
{
135122
throw new NotImplementedException();
136123
}
137124

138125
public async Task<DataResponse<TTuple[]>> Update<TTuple, TKey>(TKey key, UpdateOperation[] updateOperations)
139-
where TKey : ITarantoolTuple
140-
where TTuple : ITarantoolTuple
141126
{
142127
var updateRequest = new UpdateRequest<TKey>(
143128
SpaceId,
@@ -149,7 +134,6 @@ public async Task<DataResponse<TTuple[]>> Update<TTuple, TKey>(TKey key, UpdateO
149134
}
150135

151136
public async Task Upsert<TKey>(TKey key, UpdateOperation[] updateOperations)
152-
where TKey : ITarantoolTuple
153137
{
154138
var updateRequest = new UpsertRequest<TKey>(
155139
SpaceId,
@@ -160,8 +144,6 @@ public async Task Upsert<TKey>(TKey key, UpdateOperation[] updateOperations)
160144
}
161145

162146
public async Task<DataResponse<TTuple[]>> Delete<TKey, TTuple>(TKey key)
163-
where TKey : ITarantoolTuple
164-
where TTuple : ITarantoolTuple
165147
{
166148
var deleteRequest = new DeleteRequest<TKey>(SpaceId, Id, key);
167149

src/progaudi.tarantool/Model/Requests/CallRequest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace ProGaudi.Tarantool.Client.Model.Requests
44
{
55
public class CallRequest<T> : IRequest
6-
where T : ITarantoolTuple
76
{
87
private readonly bool _use17;
98

src/progaudi.tarantool/Model/Requests/DeleteRequest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace ProGaudi.Tarantool.Client.Model.Requests
44
{
55
public class DeleteRequest<T> : IRequest
6-
where T : ITarantoolTuple
76
{
87
public DeleteRequest(uint spaceId, uint indexId, T key)
98
{

0 commit comments

Comments
 (0)