Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16553


Ignore:
Timestamp:
01/24/19 19:22:44 (5 years ago)
Author:
gkronber
Message:

#2520 for Hive serialization: added collection of serialized types and fall-back to old persistence format on deserialization. ITask must be a StorableType

Location:
branches/2520_PersistenceReintegration
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2520_PersistenceReintegration/HeuristicLab.Clients.Hive/3.3/Util/PersistenceUtil.cs

    r16480 r16553  
    2424using System.IO;
    2525using HEAL.Fossil;
     26using HeuristicLab.Persistence.Default.Xml;
    2627
    2728namespace HeuristicLab.Clients.Hive {
    2829  public static class PersistenceUtil {
    2930    public static byte[] Serialize(object obj, out IEnumerable<Type> types) {
    30       using (MemoryStream memStream = new MemoryStream()) {
    31         throw new NotImplementedException("Not supported by HEAL.Fossil yet."); // TODO
    32         // XmlGenerator.Serialize(obj, memStream, ConfigurationService.Instance.GetConfiguration(new XmlFormat()), false, out types);
    33         // byte[] jobByteArray = memStream.ToArray();
    34         // return jobByteArray;
    35       }
     31      var ser = new ProtoBufSerializer();
     32      return ser.Serialize(obj, out types);
    3633    }
    3734
     
    4340    public static T Deserialize<T>(byte[] sjob) {
    4441      var ser = new ProtoBufSerializer();
    45       return (T)ser.Deserialize(sjob);
     42      try {
     43        return (T)ser.Deserialize(sjob);
     44      } catch (Exception) {
     45        // retry with old persistence
     46        using (MemoryStream memStream = new MemoryStream(sjob)) {
     47          return XmlParser.Deserialize<T>(memStream);
     48        }
     49      }
    4650    }
    4751  }
  • branches/2520_PersistenceReintegration/HeuristicLab.Hive/3.3/HeuristicLab.Hive-3.3.csproj

    r16452 r16553  
    8989  </PropertyGroup>
    9090  <ItemGroup>
     91    <Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
     92      <HintPath>..\..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
     93    </Reference>
     94    <Reference Include="HEAL.Fossil, Version=1.0.2.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     95      <HintPath>..\..\packages\HEAL.Fossil.1.0.2-pre-02\lib\netstandard2.0\HEAL.Fossil.dll</HintPath>
     96    </Reference>
    9197    <Reference Include="System" />
    9298    <Reference Include="System.Core" />
    9399    <Reference Include="System.Drawing" />
     100    <Reference Include="System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
     101      <HintPath>..\..\packages\System.Drawing.Common.4.5.1\lib\net461\System.Drawing.Common.dll</HintPath>
     102    </Reference>
    94103    <Reference Include="System.Xml.Linq" />
    95104    <Reference Include="System.Data.DataSetExtensions" />
     
    98107  </ItemGroup>
    99108  <ItemGroup>
     109    <None Include="packages.config" />
    100110    <None Include="Properties\AssemblyInfo.cs.frame" />
    101111    <None Include="Plugin.cs.frame" />
  • branches/2520_PersistenceReintegration/HeuristicLab.Hive/3.3/ITask.cs

    r16453 r16553  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HEAL.Fossil;
    2526
    2627namespace HeuristicLab.Hive {
     28  [StorableType("197BB925-85AD-4DAE-A5F8-9EC33C07A0AF")]
    2729  public interface ITask : IDeepCloneable, ICloneable {
    2830    TimeSpan ExecutionTime { get; }
Note: See TracChangeset for help on using the changeset viewer.