#pragma once #include "td/actor/actor.h" #include "td/utils/port/FileFd.h" #include "td/utils/buffer.h" namespace ton { class Package { public: static td::Result open(std::string path, bool read_only = false, bool create = false); Package(td::FileFd fd); td::Status truncate(td::uint64 size); td::uint64 append(std::string filename, td::Slice data, bool sync = true); void sync(); td::uint64 size() const; td::Result> read(td::uint64 offset) const; td::Result advance(td::uint64 offset); void iterate(std::function func); td::FileFd &fd() { return fd_; } private: td::FileFd fd_; }; } // namespace ton