Пример #1
0
func (e FileEntry) Serialize(w io.Writer) (size int) {
	size += core.WriteUint32(w, uint32(0x66656E74)) // "fent"
	size += e.FileName.Serialize(w)
	size += core.WriteInt64(w, e.FileSize)
	size += core.WriteUint32(w, e.FileMode)
	size += core.WriteInt64(w, e.ModTime)
	size += e.ReferenceID.Serialize(w)

	size += core.WriteUint8(w, e.ContentType)
	if e.HasContentBlockID() {
		size += e.ContentBlockID.Serialize(w)
	}
	if e.HasDecryptKey() {
		size += e.DecryptKey.Serialize(w)
	}
	if e.HasFileLink() {
		size += e.FileLink.Serialize(w)
	}
	return
}
Пример #2
0
func (t *dbTx) Serialize(w io.Writer) {
	core.WriteInt64(w, t.timestamp)
	core.WriteUint32(w, t.txType)
	t.data.(core.Serializer).Serialize(w)
}