Skip to content

Instantly share code, notes, and snippets.

@Scooletz
Last active February 15, 2018 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scooletz/8419673fdfc3479c589bab88c25dbc8f to your computer and use it in GitHub Desktop.
Save Scooletz/8419673fdfc3479c589bab88c25dbc8f to your computer and use it in GitHub Desktop.
EventStore's TFChunk writing a reversable entry
var workItem = _writerWorkItem;
var buffer = workItem.Buffer;
var bufferWriter = workItem.BufferWriter;
buffer.SetLength(4);
buffer.Position = 4;
record.WriteTo(bufferWriter);
var length = (int) buffer.Length - 4;
bufferWriter.Write(length); // length suffix
buffer.Position = 0;
bufferWriter.Write(length); // length prefix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment