|
|
|
@ -144,9 +144,8 @@ class StringSink : public FSWritableFile { |
|
|
|
|
if (reader_contents_ != nullptr) { |
|
|
|
|
assert(reader_contents_->size() <= last_flush_); |
|
|
|
|
size_t offset = last_flush_ - reader_contents_->size(); |
|
|
|
|
*reader_contents_ = Slice( |
|
|
|
|
contents_.data() + offset, |
|
|
|
|
contents_.size() - offset); |
|
|
|
|
*reader_contents_ = |
|
|
|
|
Slice(contents_.data() + offset, contents_.size() - offset); |
|
|
|
|
last_flush_ = contents_.size(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -165,8 +164,8 @@ class StringSink : public FSWritableFile { |
|
|
|
|
void Drop(size_t bytes) { |
|
|
|
|
if (reader_contents_ != nullptr) { |
|
|
|
|
contents_.resize(contents_.size() - bytes); |
|
|
|
|
*reader_contents_ = Slice( |
|
|
|
|
reader_contents_->data(), reader_contents_->size() - bytes); |
|
|
|
|
*reader_contents_ = |
|
|
|
|
Slice(reader_contents_->data(), reader_contents_->size() - bytes); |
|
|
|
|
last_flush_ = contents_.size(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -282,7 +281,7 @@ class StringSource : public FSRandomAccessFile { |
|
|
|
|
mmap_(mmap), |
|
|
|
|
total_reads_(0) {} |
|
|
|
|
|
|
|
|
|
virtual ~StringSource() { } |
|
|
|
|
virtual ~StringSource() {} |
|
|
|
|
|
|
|
|
|
uint64_t Size() const { return contents_.size(); } |
|
|
|
|
|
|
|
|
@ -324,7 +323,7 @@ class StringSource : public FSRandomAccessFile { |
|
|
|
|
char* rid = id; |
|
|
|
|
rid = EncodeVarint64(rid, uniq_id_); |
|
|
|
|
rid = EncodeVarint64(rid, 0); |
|
|
|
|
return static_cast<size_t>(rid-id); |
|
|
|
|
return static_cast<size_t>(rid - id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int total_reads() const { return total_reads_; } |
|
|
|
|