8 #include "google/protobuf/io/zero_copy_stream_impl.h" 19 bool Next(
const void **data,
int *size)
override;
20 void BackUp(
int count)
override;
21 bool Skip(
int count)
override;
22 google::protobuf::int64 ByteCount()
const override;
25 uint64_t BytesRemaining();
26 void Reset(uint64_t size);
27 uint64_t Reset(google::protobuf::io::ZeroCopyInputStream &stream);
32 std::vector<uint8_t> bytes;
46 Reader(std::string filename);
56 Event *Next(
Event *recycledEvent = NULL,
bool metadataOnly =
false);
60 bool Next(std::string *data);
63 uint64_t Skip(uint64_t nEvents);
73 const google::protobuf::DescriptorPool *
DescriptorPool() {
return &descriptorPool; }
77 void readFromBucket(
Event *event);
78 void readFromBucket(std::string *data);
81 uint64_t syncToMagic(google::protobuf::io::CodedInputStream *stream);
84 google::protobuf::io::FileInputStream *fileStream;
87 proto::BucketHeader *bucketHeader;
88 uint64_t bucketEventsRead;
92 std::map<std::string, std::shared_ptr<const std::string>> metadata;
93 google::protobuf::DescriptorPool descriptorPool;
97 virtual const char *what()
const throw() {
return "Failed to open file for reading"; }
101 virtual const char *what()
const throw() {
return "Failed to deserialize message"; }
102 } deserializationError;
105 virtual const char *what()
const throw() {
return "Bucket is corrupt"; }
106 } corruptBucketError;
109 virtual const char *what()
const throw() {
return "Bad LZ4 frame"; }
113 virtual const char *what()
const throw() {
return "Failed to seek file"; }
117 virtual const char *what()
const throw() {
return "Unexpected IO Error"; }
121 #endif // PROIO_READER_H
const google::protobuf::DescriptorPool * DescriptorPool()