| 729 | } |
| 730 | |
| 731 | Status WritablePBContainerFile::OpenExisting() { |
| 732 | DCHECK_EQ(FileState::NOT_INITIALIZED, state_); |
| 733 | optional<uint64_t> size; |
| 734 | RETURN_NOT_OK(ParsePBFileHeader(writer_.get(), &size, &offset_, &version_)); |
| 735 | ContainerSupHeaderPB sup_header; |
| 736 | RETURN_NOT_OK(ReadSupplementalHeader(writer_.get(), version_, &size, |
| 737 | &offset_, &sup_header)); |
| 738 | offset_ = *size; // Reset the write offset to the end of the file. |
| 739 | state_ = FileState::OPEN; |
| 740 | return Status::OK(); |
| 741 | } |
| 742 | |
| 743 | Status WritablePBContainerFile::AppendBytes(const Slice& data) { |
| 744 | std::lock_guard<Mutex> l(offset_lock_); |