c# - Protobuf-net asking for TypeModel.CS when used with Generics for deserialization -
i have billions of objects i'm trying construction them in b+tree serialized hdd. i'm using bplustree library info construction , protobuf-net serialization/deserialization. in regard define classes as:
[protocontract] public class b<c, m> c : icomparable<c> m : idata<c> { internal b() { lambda = new list<lambda<c, m>>(); omega = 0; } internal b(c coordinate) { lambda = new list<lambda<c, m>>(); e = coordinate; omega = 0; } [protomember(1)] internal c e { set; get; } [protomember(2)] internal list<lambda<c, m>> lambda { private set; get; } [protomember(3)] internal int omega { set; get; } } [protocontract] public class lambda<c, m> c : icomparable<c> m : idata<c> { internal lambda() { } internal lambda(char tau, m ati) { this.tau = tau; this.ati = ati; } [protomember(1)] internal char tau { private set; get; } [protomember(2)] internal m ati { private set; get; } }
and define serializers/deserializers following:
public class bserializer<c, m> : iserializer<b<c, m>> c : icomparable<c> m : idata<c> { public b<c, m> readfrom(system.io.stream stream) { homecoming serializer.deserialize<b<c, m>>(stream); } public void writeto(b<c, m> value, system.io.stream stream) { serializer.serialize<b<c, m>>(stream, value); } }
then utilize them in b+tree (this library) info construction defined as:
var options = new bplustree<c, b<c, m>>.optionsv2(cserializer, bserializer); var mytree = new bplustree<c, b<c, m>>(options);
the b+tree defined dictionary of key-value pairs. key
(i.e., c
) integer , serializer default serializer of bplustree
library. value
custom object b<c,m>
serialized using protobuf-net
.
my problem certainly happens, @ random times; searching keys
, starts deserializing value
, @ first phone call of b<c, m> readfrom(system.io.stream stream)
asks typemodel.cs
, protoreader.cs
files. both packages nuget
.
checking code, looks calling code assumes serializations aware of own length; source:
foreach (t in items) _serializer.writeto(i, io);
protobuf messages are not self-terminating - google protobuf specification defines append===merge. such, you'll need prefix messages. fortunately, should able switch serializewithlengthprefix
, deserializewithlengthprefix
. if doesn't work, worth putting reproducible illustration can investigated.
c# .net serialization protobuf-net b-plus-tree
No comments:
Post a Comment