Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ocf_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,18 @@ func (ocfw *OCFWriter) appendDataIntoBlock(data []interface{}) error {

}

return ocfw.AppendBlock(block, len(data))
}

func (ocfw *OCFWriter) AppendBlock(block []byte, count int) error {
// create file data block
buf := make([]byte, 0, len(block)+ocfBlockConst) // pre-allocate block bytes
buf, _ = longBinaryFromNative(buf, len(data)) // block count (number of data items)
buf, _ = longBinaryFromNative(buf, count) // block count (number of data items)
buf, _ = longBinaryFromNative(buf, len(block)) // block size (number of bytes in block)
buf = append(buf, block...) // serialized objects
buf = append(buf, ocfw.header.syncMarker[:]...) // sync marker

_, err = ocfw.iow.Write(buf)
_, err := ocfw.iow.Write(buf)
return err
}

Expand Down