+ header = WritableObjects.readLongHeader(in);
+ long ls = WritableObjects.readFirstLong(in, header);
+ Verify.verify(ls >= 0 && ls <= Integer.MAX_VALUE);
+ final int csize = (int) ls;
+
+ ls = WritableObjects.readSecondLong(in, header);
+ Verify.verify(ls >= 0 && ls <= Integer.MAX_VALUE);
+ final int psize = (int) ls;
+
+ final Map<UnsignedLong, Boolean> closedTransactions = new HashMap<>(csize);
+ for (int i = 0; i < csize; ++i) {
+ final UnsignedLong key = UnsignedLong.fromLongBits(WritableObjects.readLong(in));
+ final Boolean value = Boolean.valueOf(in.readBoolean());
+ closedTransactions.put(key, value);
+ }
+ final RangeSet<UnsignedLong> purgedTransactions = TreeRangeSet.create();
+ for (int i = 0; i < psize; ++i) {
+ final byte h = WritableObjects.readLongHeader(in);
+ final UnsignedLong l = UnsignedLong.fromLongBits(WritableObjects.readFirstLong(in, h));
+ final UnsignedLong u = UnsignedLong.fromLongBits(WritableObjects.readSecondLong(in, h));
+ purgedTransactions.add(Range.closed(l, u));
+ }
+
+ return new FrontendHistoryMetadata(historyId, cookie, closed, closedTransactions, purgedTransactions);