JournalEntry ReadEntry(BufferReader reader)
        {
            var journalEntry = new JournalEntry();

            journalEntry.Address = reader.ReadInt64();
            var dataLength = reader.ReadInt32();

            journalEntry.Data  = reader.ReadBytes(dataLength);
            journalEntry.Stamp = reader.ReadInt64();
            var streamNameLength = reader.ReadInt32();
            var streamNameBytes  = reader.ReadBytes(streamNameLength);

            journalEntry.StreamName = Encoding.UTF8.GetString(streamNameBytes, 0, streamNameBytes.Length);
            return(journalEntry);
        }
Esempio n. 2
0
        public Node <EmptyRecordIndexKey> Deserialize(byte[] bytes)
        {
            var reader = new BufferReader(bytes);
            var degree = reader.ReadInt32();
            var node   = new Node <EmptyRecordIndexKey>(degree);

            var nrOfEntries = reader.ReadInt32();

            for (int i = 0; i < nrOfEntries; i++)
            {
                node.EntryList.Add(ReadEntry(reader));
            }
            var nrOfChildAddresses = reader.ReadInt32();

            for (int i = 0; i < nrOfChildAddresses; i++)
            {
                node.ChildrenAddresses.Add(reader.ReadInt64());
            }
            return(node);
        }
        public CollectionFileRoot Deserialize(byte[] bytes)
        {
            var reader = new BufferReader(bytes);
            var root   = new CollectionFileRoot();

            reader.ReadByte(); //read SERIALIZATION_VERSION
            root.FormatVersion           = reader.ReadInt32();
            root.Head                    = reader.ReadInt64();
            root.NamedRecordIndexAddress = reader.ReadInt64();

            root.Clean();
            return(root);
        }
Esempio n. 4
0
        Entry <EmptyRecordIndexKey> ReadEntry(BufferReader reader)
        {
            var s       = reader.ReadInt32();
            var a       = reader.ReadInt64();
            var pointer = reader.ReadInt64();

            return(new Entry <EmptyRecordIndexKey>
            {
                Key = new EmptyRecordIndexKey {
                    S = s, A = a
                },
                Pointer = pointer
            });
        }
        public TransactionJournal Deserialize(byte[] bytes)
        {
            var reader = new BufferReader(bytes);

            reader.ReadByte(); //FORMAT_VERSION

            var journal    = new TransactionJournal();
            var entryCount = reader.ReadInt32();

            for (int i = 0; i < entryCount; i++)
            {
                journal.Entries.Add(ReadEntry(reader));
            }
            return(journal);
        }