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

Map to hold outstanding scanners. More...

#include <ScannerMap.h>

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

Classes

struct  ScanInfo
 Holds scanner information. More...
 

Public Member Functions

int32_t put (MergeScannerRangePtr &scanner, RangePtr &range, const TableIdentifier &table, ProfileDataScanner &profile_data)
 This method computes a unique scanner ID and puts the given scanner and range pointers into a map using the scanner ID as the key. More...
 
bool get (int32_t id, MergeScannerRangePtr &scanner, RangePtr &range, TableIdentifierManaged &table, ProfileDataScanner *profile_data)
 This method retrieves the scanner and range mapped to the given scanner id. More...
 
bool remove (int32_t id)
 This method removes the entry in the scanner map corresponding to the given id. More...
 
void purge_expired (int32_t max_idle_ms)
 This method iterates through the scanner map purging mappings that have not been referenced for max_idle_ms or greater milliseconds. More...
 
void get_counts (int32_t *totalp, CstrToInt32Map &table_scanner_count_map)
 This method retrieves outstanding scanner counts. More...
 
void update_profile_data (int32_t id, ProfileDataScanner &profile_data)
 Updates profile data of a scanner in the map. More...
 

Private Member Functions

int64_t get_timestamp_millis ()
 Returns the number of milliseconds since the epoch. More...
 

Private Attributes

std::mutex m_mutex
 Mutex for serializing access to members More...
 
std::unordered_map< int32_t,
ScanInfo
m_scanner_map
 Scanner map. More...
 

Static Private Attributes

static std::atomic< int > ms_next_id {0}
 Next available scanner ID. More...
 

Detailed Description

Map to hold outstanding scanners.

Definition at line 45 of file ScannerMap.h.

Member Function Documentation

bool ScannerMap::get ( int32_t  id,
MergeScannerRangePtr scanner,
RangePtr range,
TableIdentifierManaged table,
ProfileDataScanner profile_data 
)

This method retrieves the scanner and range mapped to the given scanner id.

It also updates the 'last_access_millis' member of this scanner map entry.

Parameters
idscanner id
scannersmart pointer to returned scanner object
rangesmart pointer to returned range object
tablereference to (managed) table identifier
profile_dataPointer to profile data structure populated by this function
Returns
true if found, false if not

Definition at line 59 of file ScannerMap.cc.

void ScannerMap::get_counts ( int32_t *  totalp,
CstrToInt32Map table_scanner_count_map 
)

This method retrieves outstanding scanner counts.

It returns the total number of outstanding scanners as well as the number of outstanding scanners per-table. Only the tables that exist in the table_scanner_count_map that is passed into this method will be counted.

Parameters
totalpaddress of variable to hold total outstanding counters
table_scanner_count_mapreference to table count map (NOTE: must be filled in by caller, no new entries will be added)

Definition at line 104 of file ScannerMap.cc.

int64_t ScannerMap::get_timestamp_millis ( )
private

Returns the number of milliseconds since the epoch.

Returns
Milliseconds since epoch

Definition at line 127 of file ScannerMap.cc.

void ScannerMap::purge_expired ( int32_t  max_idle_ms)

This method iterates through the scanner map purging mappings that have not been referenced for max_idle_ms or greater milliseconds.

Parameters
max_idle_msmaximum idle time

Definition at line 83 of file ScannerMap.cc.

int32_t ScannerMap::put ( MergeScannerRangePtr scanner,
RangePtr range,
const TableIdentifier table,
ProfileDataScanner profile_data 
)

This method computes a unique scanner ID and puts the given scanner and range pointers into a map using the scanner ID as the key.

Parameters
scannersmart pointer to scanner object
rangesmart pointer to range object
tabletable identifier for this scanner
profile_dataScanner profile data
Returns
unique scanner ID

Definition at line 40 of file ScannerMap.cc.

bool ScannerMap::remove ( int32_t  id)

This method removes the entry in the scanner map corresponding to the given id.

Parameters
idscanner id
Returns
true if removed, false if no mapping found

Definition at line 77 of file ScannerMap.cc.

void ScannerMap::update_profile_data ( int32_t  id,
ProfileDataScanner profile_data 
)

Updates profile data of a scanner in the map.

Parameters
idScanner ID of scanner
profile_datanew profile data to associate with scanner

Definition at line 117 of file ScannerMap.cc.

Member Data Documentation

std::mutex Hypertable::ScannerMap::m_mutex
private

Mutex for serializing access to members

Definition at line 124 of file ScannerMap.h.

std::unordered_map<int32_t, ScanInfo> Hypertable::ScannerMap::m_scanner_map
private

Scanner map.

Definition at line 141 of file ScannerMap.h.

atomic< int > ScannerMap::ms_next_id {0}
staticprivate

Next available scanner ID.

Definition at line 121 of file ScannerMap.h.


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