You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bl...@apache.org on 2020/12/04 10:21:34 UTC

[pulsar-dotpulsar] branch master updated: Upgrading the protobuf-net NuGet package to allow for deserialization of ReadOnlySequences.

This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 02a6f31  Upgrading the protobuf-net NuGet package to allow for deserialization of ReadOnlySequences.
02a6f31 is described below

commit 02a6f316a354074ee05e34a7922474c2b294de73
Author: Daniel Blankensteiner <db...@vmail.dk>
AuthorDate: Fri Dec 4 11:21:23 2020 +0100

    Upgrading the protobuf-net NuGet package to allow for deserialization of ReadOnlySequences.
---
 CHANGELOG.md                         | 10 ++++++++++
 src/DotPulsar/DotPulsar.csproj       |  2 +-
 src/DotPulsar/Internal/Serializer.cs |  7 +------
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 59e7139..9345915 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [Unreleased]
+
+### Added
+
+- Added performance improvements when receiving data
+
+### Changed
+
+- The protobuf-net dependency is upgraded from 2.4.6 to 3.X
+
 ## [0.9.7] - 2020-12-04
 
 ### Added
diff --git a/src/DotPulsar/DotPulsar.csproj b/src/DotPulsar/DotPulsar.csproj
index feacd39..9dcf9af 100644
--- a/src/DotPulsar/DotPulsar.csproj
+++ b/src/DotPulsar/DotPulsar.csproj
@@ -23,7 +23,7 @@
   <ItemGroup>    
     <PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.0" />    
     <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
-    <PackageReference Include="protobuf-net" Version="2.4.6" />
+    <PackageReference Include="protobuf-net" Version="3.0.73" />
     <PackageReference Include="System.IO.Pipelines" Version="5.0.0" />
   </ItemGroup>
 
diff --git a/src/DotPulsar/Internal/Serializer.cs b/src/DotPulsar/Internal/Serializer.cs
index fe1f09a..87edb06 100644
--- a/src/DotPulsar/Internal/Serializer.cs
+++ b/src/DotPulsar/Internal/Serializer.cs
@@ -21,12 +21,7 @@ namespace DotPulsar.Internal
 
     public static class Serializer
     {
-        public static T Deserialize<T>(ReadOnlySequence<byte> sequence)
-        {
-            //TODO Fix this when protobuf-net start supporting sequences or .NET supports creating a stream from a sequence
-            using var ms = new MemoryStream(sequence.ToArray());
-            return ProtoBuf.Serializer.Deserialize<T>(ms);
-        }
+        public static T Deserialize<T>(ReadOnlySequence<byte> sequence) => ProtoBuf.Serializer.Deserialize<T>(sequence);
 
         public static ReadOnlySequence<byte> Serialize(BaseCommand command)
         {