I use protobuf to store events in playback file for further replaying.
I use Coded*Stream on top of Gzip*Stream which is on top of
File*Stream. The playback file is big enough, can be up to 3 GB a day
(hundreds of millions of events).
Everything works ok - all events encoded in the file can be replayed
back just fine.
Now I need to navigate through the playback (forth and back), kind of
I wanted to periodically insert special key frames that include such
information as byte offset of previous key frame (to rewind back) and
similar offset of the next key frame (to rewind forth), plus some
other key data. So I would navigate through the file faster by
skipping big portions of events between such key frames.
In order to maintain key frames linked each to other I need to move
back in the output buffer, modify previous key frame with correct
value of offset field and move forward to the initial position in
order to serialize next key frame and further events and so on. If
needed key frame can be of fixed size (e.g. sfixed64 types can be
Reading and partial parsing of all events until good one is found is
not an option.

How is this possible with protobuf implementation? e.g.
CodedOutputStream::Skip(int count) doesn't accept negative count as a

Perhaps there is alternate way to reach the goal - fast navigation in
the binary gzip'ed file that includes messages of variable length.
Any thoughts?

Thank you in advance.


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to