Skip to content

Commit 3f707ff

Browse files
committed
React to transport changes 0.3.0
1 parent 7fb9f91 commit 3f707ff

22 files changed

+251
-299
lines changed

Elasticsearch.sln

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D455EC79-E1E
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Playground", "src\Playground\Playground.csproj", "{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}"
99
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Elastic.Transport", "..\elastic-transport-net\src\Elastic.Transport\Elastic.Transport.csproj", "{14E44695-6737-49B2-8AD5-7AA77E4205D2}"
11-
EndProject
1210
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{362B2776-4B29-46AB-B237-56776B5372B6}"
1311
EndProject
1412
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "tests\Tests\Tests.csproj", "{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}"
@@ -80,18 +78,6 @@ Global
8078
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}.Release|x64.Build.0 = Release|Any CPU
8179
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}.Release|x86.ActiveCfg = Release|Any CPU
8280
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB}.Release|x86.Build.0 = Release|Any CPU
83-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
84-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
85-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Debug|x64.ActiveCfg = Debug|Any CPU
86-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Debug|x64.Build.0 = Debug|Any CPU
87-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Debug|x86.ActiveCfg = Debug|Any CPU
88-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Debug|x86.Build.0 = Debug|Any CPU
89-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
90-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Release|Any CPU.Build.0 = Release|Any CPU
91-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Release|x64.ActiveCfg = Release|Any CPU
92-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Release|x64.Build.0 = Release|Any CPU
93-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Release|x86.ActiveCfg = Release|Any CPU
94-
{14E44695-6737-49B2-8AD5-7AA77E4205D2}.Release|x86.Build.0 = Release|Any CPU
9581
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
9682
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
9783
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -242,7 +228,6 @@ Global
242228
EndGlobalSection
243229
GlobalSection(NestedProjects) = preSolution
244230
{8F2EA767-8746-4816-B6EE-342BCB8F1AAB} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7}
245-
{14E44695-6737-49B2-8AD5-7AA77E4205D2} = {D455EC79-E1E0-4509-B297-0DA3AED8DFF7}
246231
{BDF1ABC2-8C52-4864-B824-B1FA27630E8E} = {362B2776-4B29-46AB-B237-56776B5372B6}
247232
{70225C3F-393A-40F5-A778-8FF71A38C4C0} = {362B2776-4B29-46AB-B237-56776B5372B6}
248233
{587DE66B-6FAB-4722-9C53-2812BEFB6A44} = {362B2776-4B29-46AB-B237-56776B5372B6}

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.Customization.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ public override object Deserialize(Type type, Stream stream)
4040
return _serializer.Deserialize(jsonTextReader, type);
4141
}
4242

43-
public override async Task<T> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = default)
43+
public override async ValueTask<T> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = default)
4444
{
4545
using var streamReader = new StreamReader(stream);
4646
using var jsonTextReader = new JsonTextReader(streamReader);
4747
var token = await jsonTextReader.ReadTokenWithDateParseHandlingNoneAsync(cancellationToken).ConfigureAwait(false);
4848
return token.ToObject<T>(_serializer);
4949
}
5050

51-
public override async Task<object> DeserializeAsync(Type type, Stream stream, CancellationToken cancellationToken = default(CancellationToken))
51+
public override async ValueTask<object> DeserializeAsync(Type type, Stream stream, CancellationToken cancellationToken = default(CancellationToken))
5252
{
5353
using var streamReader = new StreamReader(stream);
5454
using var jsonTextReader = new JsonTextReader(streamReader);

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/packages.lock.json

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@
3333
"resolved": "12.0.1",
3434
"contentHash": "pBR3wCgYWZGiaZDYP+HHYnalVnPJlpP1q55qvVb+adrDHmFMDc1NAKio61xTwftK3Pw5h7TZJPJEEVMd6ty8rg=="
3535
},
36+
"Elastic.Transport": {
37+
"type": "Transitive",
38+
"resolved": "0.3.0",
39+
"contentHash": "XjkukaPKVF3kgX1K0K8kHU84fYUXRwkE5J+23odNdQY80kOt0SbX4vdQ0xm8lp5fp0SEG6YkmzCw2TBzI/nPIg==",
40+
"dependencies": {
41+
"Microsoft.CSharp": "4.7.0",
42+
"System.Buffers": "4.5.1",
43+
"System.Diagnostics.DiagnosticSource": "5.0.1",
44+
"System.Text.Json": "6.0.1",
45+
"System.Threading.Tasks.Extensions": "4.5.4"
46+
}
47+
},
3648
"Microsoft.Bcl.AsyncInterfaces": {
3749
"type": "Transitive",
3850
"resolved": "6.0.0",
@@ -136,17 +148,7 @@
136148
"elastic.clients.elasticsearch": {
137149
"type": "Project",
138150
"dependencies": {
139-
"Elastic.Transport": "1.0.0"
140-
}
141-
},
142-
"elastic.transport": {
143-
"type": "Project",
144-
"dependencies": {
145-
"Microsoft.CSharp": "4.7.0",
146-
"System.Buffers": "4.5.1",
147-
"System.Diagnostics.DiagnosticSource": "5.0.1",
148-
"System.Text.Json": "6.0.1",
149-
"System.Threading.Tasks.Extensions": "4.5.4"
151+
"Elastic.Transport": "0.3.0"
150152
}
151153
}
152154
},
@@ -188,6 +190,18 @@
188190
"resolved": "12.0.1",
189191
"contentHash": "pBR3wCgYWZGiaZDYP+HHYnalVnPJlpP1q55qvVb+adrDHmFMDc1NAKio61xTwftK3Pw5h7TZJPJEEVMd6ty8rg=="
190192
},
193+
"Elastic.Transport": {
194+
"type": "Transitive",
195+
"resolved": "0.3.0",
196+
"contentHash": "XjkukaPKVF3kgX1K0K8kHU84fYUXRwkE5J+23odNdQY80kOt0SbX4vdQ0xm8lp5fp0SEG6YkmzCw2TBzI/nPIg==",
197+
"dependencies": {
198+
"Microsoft.CSharp": "4.7.0",
199+
"System.Buffers": "4.5.1",
200+
"System.Diagnostics.DiagnosticSource": "5.0.1",
201+
"System.Text.Json": "6.0.1",
202+
"System.Threading.Tasks.Extensions": "4.5.4"
203+
}
204+
},
191205
"Microsoft.Bcl.AsyncInterfaces": {
192206
"type": "Transitive",
193207
"resolved": "6.0.0",
@@ -386,20 +400,10 @@
386400
"elastic.clients.elasticsearch": {
387401
"type": "Project",
388402
"dependencies": {
389-
"Elastic.Transport": "1.0.0",
403+
"Elastic.Transport": "0.3.0",
390404
"System.Reflection.Emit": "4.3.0",
391405
"System.Reflection.Emit.Lightweight": "4.3.0"
392406
}
393-
},
394-
"elastic.transport": {
395-
"type": "Project",
396-
"dependencies": {
397-
"Microsoft.CSharp": "4.7.0",
398-
"System.Buffers": "4.5.1",
399-
"System.Diagnostics.DiagnosticSource": "5.0.1",
400-
"System.Text.Json": "6.0.1",
401-
"System.Threading.Tasks.Extensions": "4.5.4"
402-
}
403407
}
404408
}
405409
}

src/Elastic.Clients.Elasticsearch/Client/ElasticClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System.Threading;
88
using System.Threading.Tasks;
99
using Elastic.Transport;
10-
using Elastic.Transport.Products.Elasticsearch.Failures;
1110

1211
namespace Elastic.Clients.Elasticsearch;
1312

src/Elastic.Clients.Elasticsearch/Client/NamespacedClientProxy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Threading;
33
using System.Threading.Tasks;
44
using Elastic.Transport;
5-
using Elastic.Transport.Products.Elasticsearch.Failures;
5+
using Elastic.Transport.Products.Elasticsearch;
66

77
namespace Elastic.Clients.Elasticsearch
88
{

src/Elastic.Clients.Elasticsearch/Common/LazyDocument.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public object As(Type objectType)
6565
/// <see cref="LazyDocument" /> instance.
6666
/// </summary>
6767
/// <typeparam name="T">The type</typeparam>
68-
public Task<T> AsAsync<T>(CancellationToken ct = default)
68+
public ValueTask<T> AsAsync<T>(CancellationToken ct = default)
6969
{
7070
using var ms = _memoryStreamFactory.Create(Bytes);
7171
return _sourceSerializer.DeserializeAsync<T>(ms, ct);
@@ -76,7 +76,7 @@ public Task<T> AsAsync<T>(CancellationToken ct = default)
7676
/// <see cref="LazyDocument" /> instance.
7777
/// </summary>
7878
/// <param name="objectType">The type</param>
79-
public Task<object> AsAsync(Type objectType, CancellationToken ct = default)
79+
public ValueTask<object> AsAsync(Type objectType, CancellationToken ct = default)
8080
{
8181
using var ms = _memoryStreamFactory.Create(Bytes);
8282
return _sourceSerializer.DeserializeAsync(objectType, ms, ct);

src/Elastic.Clients.Elasticsearch/Elastic.Clients.Elasticsearch.csproj

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<PackageId>Elastic.Clients.Elasticsearch</PackageId>
4-
<Title>Elastic.Clients.Elasticsearch - Elasticsearch .NET high level client</Title>
5-
<PackageTags>elasticsearch;elastic;search;lucene;nest</PackageTags>
4+
<Title>Elastic.Clients.Elasticsearch - Official Elasticsearch .NET Client</Title>
5+
<PackageTags>elasticsearch;elastic;client;search;lucene</PackageTags>
66
<Description>
77
Strongly typed interface to Elasticsearch. Fluent and classic object initializer mappings of requests and
88
responses. Uses and exposes Elasticsearch.Net.
@@ -20,10 +20,11 @@
2020
<ItemGroup>
2121
<PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="System.Reflection.Emit" Version="4.3.0" />
2222
<PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
23+
<PackageReference Include="Elastic.Transport" Version="0.3.0" />
2324
</ItemGroup>
24-
<ItemGroup>
25+
<!--<ItemGroup>
2526
<ProjectReference Include="..\..\..\elastic-transport-net\src\Elastic.Transport\Elastic.Transport.csproj" />
26-
</ItemGroup>
27+
</ItemGroup>-->
2728
<ItemGroup>
2829
<InternalsVisibleTo Include="Tests" Key="$(ExposedPublicKey)" />
2930
<InternalsVisibleTo Include="Tests.Domain" Key="$(ExposedPublicKey)" />
@@ -33,7 +34,4 @@
3334
<_Parameter1>true</_Parameter1>
3435
</AssemblyAttribute>
3536
</ItemGroup>
36-
<ItemGroup>
37-
<None Include="Client\ElasticClient-BulkAll.cs" />
38-
</ItemGroup>
3937
</Project>

src/Elastic.Clients.Elasticsearch/Serialization/NewlineDelimitedJsonSerializer.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
using System;
6+
using System.IO;
7+
using System.Text.Json;
8+
using System.Threading;
9+
using System.Threading.Tasks;
10+
using Elastic.Transport;
11+
12+
namespace Elastic.Clients.Elasticsearch;
13+
14+
public abstract class SourceSerializer : Serializer
15+
{
16+
}
17+
18+
public abstract class SystemTextJsonSourceSerializer : SourceSerializer
19+
{
20+
//private readonly SerializerRegistrationInformation _state;
21+
22+
// TODO - Implement diagnostics - Types are internal to transport, so either, return to wrapped version, or move to client / implement manually.
23+
//private static DiagnosticSource DiagnosticSource { get; } = new DiagnosticListener(Serializer.SourceName);
24+
25+
//protected SystemTextJsonSourceSerializer() => _state = new SerializerRegistrationInformation(GetType(), "source");
26+
27+
public JsonSerializerOptions Options { get; init; }
28+
29+
public override T Deserialize<T>(Stream stream)
30+
{
31+
if (TryReturnDefault(stream, out T deserialize))
32+
return deserialize;
33+
34+
return JsonSerializer.Deserialize<T>(stream, Options);
35+
}
36+
37+
public override object Deserialize(Type type, Stream stream)
38+
{
39+
if (TryReturnDefault(stream, out object deserialize))
40+
return deserialize;
41+
42+
return JsonSerializer.Deserialize(stream, type, Options);
43+
}
44+
45+
private static bool TryReturnDefault<T>(Stream stream, out T deserialize)
46+
{
47+
deserialize = default;
48+
return stream == null || stream == Stream.Null || (stream.CanSeek && stream.Length == 0);
49+
}
50+
51+
public override ValueTask<T> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = default) => JsonSerializer.DeserializeAsync<T>(stream, Options, cancellationToken);
52+
53+
public override ValueTask<object> DeserializeAsync(Type type, Stream stream, CancellationToken cancellationToken = default) =>
54+
JsonSerializer.DeserializeAsync(stream, type, Options, cancellationToken);
55+
56+
public override void Serialize<T>(T data, Stream writableStream,
57+
SerializationFormatting formatting = SerializationFormatting.None)
58+
{
59+
using var writer = new Utf8JsonWriter(writableStream);
60+
JsonSerializer.Serialize(writer, data, typeof(T), Options);
61+
}
62+
63+
public override Task SerializeAsync<T>(T data, Stream stream,
64+
SerializationFormatting formatting = SerializationFormatting.None,
65+
CancellationToken cancellationToken = default) => JsonSerializer.SerializeAsync(stream, data, Options, cancellationToken);
66+
}

src/Elastic.Clients.Elasticsearch/Serialization/SystemTextJsonSourceSerializerBase.cs

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)