27 #ifndef Hypertable_Lib_CommitLog_h
28 #define Hypertable_Lib_CommitLog_h
155 StringSet &removed_logs, std::string *trace);
180 void get_stats(
const std::string &prefix, std::string &result);
186 std::lock_guard<std::mutex>lock(
m_mutex);
190 total += (*iter)->size;
195 std::lock_guard<std::mutex>lock(
m_mutex);
229 #endif // Hypertable_Lib_CommitLog_h
std::set< String > StringSet
STL Set managing Strings.
static const char MAGIC_DATA[10]
std::map< int64_t, CumulativeFragmentData > CumulativeSizeMap
int write(uint64_t cluster_id, DynamicBuffer &buffer, int64_t revision, Filesystem::Flags flags)
Writes a block of updates to the commit log.
void initialize(const std::string &log_dir, PropertiesPtr &, CommitLogBase *init_log, bool is_meta)
Abstract base class for a filesystem.
Flags
Enumeration type for append flags.
Program options handling.
const std::string & get_current_fragment_file()
int64_t get_max_fragment_size()
Returns the maximum size of each log fragment file.
Declarations for BlockCompressionCodec.
A dynamic, resizable and reference counted memory buffer.
void load_cumulative_size_map(CumulativeSizeMap &cumulative_size_map)
Fills up a map of cumulative fragment size data.
int64_t size()
Returns total size of commit log.
Declarations for CommitLogBlockStream.
void get_stats(const std::string &prefix, std::string &result)
Returns the stats on all commit log fragments.
A dynamic, resizable memory buffer.
int sync()
Sync previous updates written to commit log.
int link_log(uint64_t cluster_id, CommitLogBase *log_base)
Links an external log into this log.
static const char MAGIC_LINK[10]
std::shared_ptr< Properties > PropertiesPtr
int close()
Closes the log.
int64_t m_max_fragment_size
void remove_file_info(CommitLogFileInfo *fi, StringSet &removed_logs)
int64_t m_cur_fragment_length
Commit log for persisting range updates.
std::shared_ptr< Filesystem > FilesystemPtr
Smart pointer to Filesystem.
std::shared_ptr< CommitLog > CommitLogPtr
Smart pointer to CommitLog.
std::string m_cur_fragment_fname
int flush()
Flushes previous updates written to commit log.
A String class based on std::string.
LogFragmentQueue m_fragment_queue
std::set< CommitLogFileInfo * > m_reap_set
uint32_t m_cur_fragment_num
int64_t get_timestamp()
Atomically obtains a timestamp.
int roll(CommitLogFileInfo **clfip=0)
std::unique_ptr< BlockCompressionCodec > m_compressor
int purge(int64_t revision, StringSet &remove_ok_logs, StringSet &removed_logs, std::string *trace)
Purges the log.
int compress_and_write(DynamicBuffer &input, BlockHeader *header, int64_t revision, Filesystem::Flags flags)
CommitLog(FilesystemPtr &fs, const std::string &log_dir, PropertiesPtr &props, CommitLogBase *init_log=0, bool is_meta=true)
Constructs a CommitLog object using supplied properties.