0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::LiveFileTracker Class Reference

Tracks files that are live or referenced for purposes of maintaining the 'Files' METADATA column. More...

#include <LiveFileTracker.h>

Collaboration diagram for Hypertable::LiveFileTracker:
Collaboration graph
[legend]

Public Member Functions

 LiveFileTracker (const TableIdentifier *identifier, SchemaPtr &schema_ptr, const RangeSpec *range, const String &ag_name)
 
void change_range (const String &start_row, const String &end_row)
 
void update_live (const String &add, std::vector< String > &deletes, uint32_t nextcsid, int64_t total_blocks)
 Updates the live file set. More...
 
void add_live_noupdate (const String &fname, int64_t total_blocks)
 Adds a file to the live file set without seting the 'need_update' bit. More...
 
void add_references (const std::vector< String > &filev)
 Adds a set of files to the referenced file set. More...
 
void remove_references (const std::vector< String > &filev)
 Decrements the reference count of each file in the given vector. More...
 
void update_files_column ()
 Updates the 'Files' METADATA column if it needs updating. More...
 
void get_file_data (String &file_list, int64_t *block_countp, bool include_blocked)
 Returns '
' separated list of files, suitable for writing into the 'Files' column of METADATA. More...
 
void get_file_list (String &file_list)
 Populates string with live files separated by ';'. More...
 
void set_next_csid (uint32_t nid)
 

Private Member Functions

String strip_basename (const String &fname)
 

Private Attributes

std::mutex m_mutex
 
std::mutex m_update_mutex
 
TableIdentifierManaged m_identifier
 
String m_file_basename
 
SchemaPtr m_schema_ptr
 
String m_start_row
 
String m_end_row
 
String m_ag_name
 
FileRefCountMap m_referenced
 
std::set< Stringm_live
 
std::set< Stringm_blocked
 
bool m_need_update
 
bool m_is_root
 
uint32_t m_last_nextcsid
 
uint32_t m_cur_nextcsid
 
int64_t m_total_blocks
 

Detailed Description

Tracks files that are live or referenced for purposes of maintaining the 'Files' METADATA column.

Definition at line 42 of file LiveFileTracker.h.

Constructor & Destructor Documentation

LiveFileTracker::LiveFileTracker ( const TableIdentifier identifier,
SchemaPtr schema_ptr,
const RangeSpec range,
const String ag_name 
)

Definition at line 36 of file LiveFileTracker.cc.

Member Function Documentation

void Hypertable::LiveFileTracker::add_live_noupdate ( const String fname,
int64_t  total_blocks 
)
inline

Adds a file to the live file set without seting the 'need_update' bit.

Parameters
fnamefile to add
total_blocksTotal number of cell store blocks in access group

Definition at line 73 of file LiveFileTracker.h.

void LiveFileTracker::add_references ( const std::vector< String > &  filev)

Adds a set of files to the referenced file set.

If they already exist in the referenced file set, then their reference count is incremented.

Parameters
filevvector of filenames to add reference

Definition at line 64 of file LiveFileTracker.cc.

void Hypertable::LiveFileTracker::change_range ( const String start_row,
const String end_row 
)
inline

Definition at line 51 of file LiveFileTracker.h.

void LiveFileTracker::get_file_data ( String file_list,
int64_t *  block_countp,
bool  include_blocked 
)

Returns '
' separated list of files, suitable for writing into the 'Files' column of METADATA.

If include_blocked is set to true, then the files that are currently blocked from GC are included in the list, prefixed by the '#' character

Parameters
file_listreference to output string to hold file list
block_countpaddress of integer to hold the block count for this AG
include_blockedinclude commented out files blocked from GC

Definition at line 171 of file LiveFileTracker.cc.

void LiveFileTracker::get_file_list ( String file_list)

Populates string with live files separated by ';'.

Parameters
file_listOutput string to hold file list

Definition at line 192 of file LiveFileTracker.cc.

void LiveFileTracker::remove_references ( const std::vector< String > &  filev)

Decrements the reference count of each file in the given vector.

If the file removed is one that has been written into the 'Files' column as 'blocked', then the m_need_update flag is set to true, indicating the the column needs updating.

If any of the reference counts drop to zero, then the corresponding file is removed from the reference set.

Parameters
filevvector of filenames to remove reference

Definition at line 81 of file LiveFileTracker.cc.

void Hypertable::LiveFileTracker::set_next_csid ( uint32_t  nid)
inline

Definition at line 120 of file LiveFileTracker.h.

String LiveFileTracker::strip_basename ( const String fname)
private

Definition at line 199 of file LiveFileTracker.cc.

void LiveFileTracker::update_files_column ( )

Updates the 'Files' METADATA column if it needs updating.

Definition at line 96 of file LiveFileTracker.cc.

void LiveFileTracker::update_live ( const String add,
std::vector< String > &  deletes,
uint32_t  nextcsid,
int64_t  total_blocks 
)

Updates the live file set.

Parameters
addfilename to add
deletesvector of filenames to delete
nextcsidNext available CellStore ID
total_blocksTotal number of cell store blocks in access group

Definition at line 52 of file LiveFileTracker.cc.

Member Data Documentation

String Hypertable::LiveFileTracker::m_ag_name
private

Definition at line 135 of file LiveFileTracker.h.

std::set<String> Hypertable::LiveFileTracker::m_blocked
private

Definition at line 138 of file LiveFileTracker.h.

uint32_t Hypertable::LiveFileTracker::m_cur_nextcsid
private

Definition at line 142 of file LiveFileTracker.h.

String Hypertable::LiveFileTracker::m_end_row
private

Definition at line 134 of file LiveFileTracker.h.

String Hypertable::LiveFileTracker::m_file_basename
private

Definition at line 131 of file LiveFileTracker.h.

TableIdentifierManaged Hypertable::LiveFileTracker::m_identifier
private

Definition at line 130 of file LiveFileTracker.h.

bool Hypertable::LiveFileTracker::m_is_root
private

Definition at line 140 of file LiveFileTracker.h.

uint32_t Hypertable::LiveFileTracker::m_last_nextcsid
private

Definition at line 141 of file LiveFileTracker.h.

std::set<String> Hypertable::LiveFileTracker::m_live
private

Definition at line 137 of file LiveFileTracker.h.

std::mutex Hypertable::LiveFileTracker::m_mutex
private

Definition at line 128 of file LiveFileTracker.h.

bool Hypertable::LiveFileTracker::m_need_update
private

Definition at line 139 of file LiveFileTracker.h.

FileRefCountMap Hypertable::LiveFileTracker::m_referenced
private

Definition at line 136 of file LiveFileTracker.h.

SchemaPtr Hypertable::LiveFileTracker::m_schema_ptr
private

Definition at line 132 of file LiveFileTracker.h.

String Hypertable::LiveFileTracker::m_start_row
private

Definition at line 133 of file LiveFileTracker.h.

int64_t Hypertable::LiveFileTracker::m_total_blocks
private

Definition at line 143 of file LiveFileTracker.h.

std::mutex Hypertable::LiveFileTracker::m_update_mutex
private

Definition at line 129 of file LiveFileTracker.h.


The documentation for this class was generated from the following files: