#include <hybrid_storage_manager.h>
Inheritance diagram for Hybrid_Storage_Manager< T >:
Public Member Functions | |
Hybrid_Storage_Manager (Hazy_Database *db_conn, ondisk_storage_spec *spec, Ondisk_Storage_Manager< T > *disk, int nBuffer, bool bUseEps) | |
Constructor that initializes Hybrid_Storage_Manager. | |
void | resort (struct hazy_model &m) |
Makes a resort to reorganize entities according to their epsilon values. | |
void | incrementalUpdate (struct hazy_model &m, double &waste_time) |
Makes an incremental update on the entities by using hazy model. | |
void | insertEntity (struct hazy_model &m, key e, T f) |
Inserts the entity to the storage manager. | |
void | getEntityClass (key e, sClass &c, struct hazy_model &m) |
Retrieves the class of the entity. | |
void | getNumInClass (sClass c, int &nClass, struct hazy_model &m, double &waste_time) |
Retrieves # of elements that belong to a given class. | |
Private Types | |
typedef std::vector< struct _full_entity_entry > | _tbuffer |
typedef std::vector< struct _full_entity_entry >::iterator | _tbuffer_it |
typedef std::map< key, int > | _tentitymap |
typedef std::map< key, double > | _tepsmap |
typedef std::map< key, double >::iterator | _tepsmap_iterator |
typedef std::ostringstream | prepared_stmt |
type definition for string | |
Private Member Functions | |
bool | isLazy () |
Returns whether approach is lazy or not. | |
bool | isEager () |
Returns whether approach is eager or not. | |
void | calculateSpaceUsedByEpsMap (double &spaceUsed) |
Calculates space used by the eps map. | |
void | calculateSpaceUsedByBuffer (double &spaceUsed) |
Calculates space used by the buffer. | |
void | calculateSpaceUsedByEntityMap (double &spaceUsed) |
Calculates space used by entity map. | |
void | calculateSpaceUsed (double &spaceUsed) |
Calculates total space used in memory by eps map, entity map and the buffer. | |
Static Private Member Functions | |
static int | parse_eps_map (PGresult *res, int index, key &k, double &eps) |
Private Attributes | |
Ondisk_Storage_Manager< T > * | _disk |
Ondisk_Storage_Manager is used. | |
Hazy_Database * | _conn |
Database connection. | |
_tbuffer | _buffer |
_tentitymap | _entity_map |
bool | _epsused |
_tepsmap | _epsmap |
int | _buffer_size |
buffer size | |
double | eps_high |
low & high eps | |
double | eps_low |
_tbuffer_it | low_water_it |
low & high water iterators | |
_tbuffer_it | high_water_it |
bool | _lazy |
int | unique_id_for_ps |
unique id for prepared statements in order to prevent any conflict in the same database connection, there cannot be prepared statements with exact same name | |
prepared_stmt | query_buffer_fill |
prepared statements | |
prepared_stmt | query_eps_exec |
bool | _force_monotone |
This is required for the theory to hold. | |
int | log_se_eps_hit |
Logging variables Single Entity Counters. | |
int | log_se_eps_miss |
int | log_se_buffer_hit |
int | log_se_buffer_miss |
int | log_iu_buffer_hit |
int | log_iu_buffer_miss |
Classes | |
struct | _full_entity_entry |
full_entity_entry contains class of the example, feature vector and eps More... |
typedef std::vector<struct _full_entity_entry> Hybrid_Storage_Manager< T >::_tbuffer [private] |
typedef std::vector<struct _full_entity_entry>::iterator Hybrid_Storage_Manager< T >::_tbuffer_it [private] |
typedef std::map<key, int> Hybrid_Storage_Manager< T >::_tentitymap [private] |
typedef std::map<key, double> Hybrid_Storage_Manager< T >::_tepsmap [private] |
typedef std::map<key,double>::iterator Hybrid_Storage_Manager< T >::_tepsmap_iterator [private] |
typedef std::ostringstream Hybrid_Storage_Manager< T >::prepared_stmt [private] |
type definition for string
Hybrid_Storage_Manager< T >::Hybrid_Storage_Manager | ( | Hazy_Database * | db_conn, | |
ondisk_storage_spec * | spec, | |||
Ondisk_Storage_Manager< T > * | disk, | |||
int | nBuffer, | |||
bool | bUseEps | |||
) |
Constructor that initializes Hybrid_Storage_Manager.
[in] | db_conn | databae connection |
[in] | spec | ondisk_storage_spec |
[in] | disk | Ondisk_Storage_Manager |
[in] | nBuffer | buffer size |
[in] | bUseEps | whether use eps map or not |
void Hybrid_Storage_Manager< T >::calculateSpaceUsed | ( | double & | spaceUsed | ) | [private] |
Calculates total space used in memory by eps map, entity map and the buffer.
[out] | spaceUsed | total space used in bytes |
void Hybrid_Storage_Manager< T >::calculateSpaceUsedByBuffer | ( | double & | spaceUsed | ) | [private] |
Calculates space used by the buffer.
[out] | spaceUsed | space used by the buffer |
void Hybrid_Storage_Manager< T >::calculateSpaceUsedByEntityMap | ( | double & | spaceUsed | ) | [private] |
Calculates space used by entity map.
[out] | spaceUsed | space used by entity map |
void Hybrid_Storage_Manager< T >::calculateSpaceUsedByEpsMap | ( | double & | spaceUsed | ) | [private] |
Calculates space used by the eps map.
[out] | spaceUsed | space used by the eps map |
void Hybrid_Storage_Manager< T >::getEntityClass | ( | key | e, | |
sClass & | c, | |||
struct hazy_model & | m | |||
) | [virtual] |
Retrieves the class of the entity.
[in] | e | entitiy id |
[out] | c | class of the entity |
[in] | m | hazy model that we use to classify the entity |
Implements Storage_Manager< T >.
void Hybrid_Storage_Manager< T >::getNumInClass | ( | sClass | c, | |
int & | nClass, | |||
struct hazy_model & | m, | |||
double & | waste_time | |||
) | [virtual] |
Retrieves # of elements that belong to a given class.
[in] | c | class that we ask # of elements belong it |
[out] | nClass | # of elements in the class |
[in] | m | hazy model that we use to classify entities |
[out] | waste_time | waste time calculated during the method execution |
Implements Storage_Manager< T >.
void Hybrid_Storage_Manager< T >::incrementalUpdate | ( | struct hazy_model & | m, | |
double & | waste_time | |||
) | [virtual] |
Makes an incremental update on the entities by using hazy model.
[in] | m | hazy model that we use to update entities classes |
[out] | waste_time | waste time calcaulted during the method execution |
Implements Storage_Manager< T >.
void Hybrid_Storage_Manager< T >::insertEntity | ( | struct hazy_model & | m, | |
key | e, | |||
T | f | |||
) | [virtual] |
Inserts the entity to the storage manager.
[in] | m | hazy model which is used when the approach is hazy, because we need to calculate eps value |
[in] | e | id of the entity |
[in] | f | feature vector of the entity |
Implements Storage_Manager< T >.
bool Hybrid_Storage_Manager< T >::isEager | ( | ) | [inline, private] |
Returns whether approach is eager or not.
bool Hybrid_Storage_Manager< T >::isLazy | ( | ) | [inline, private] |
Returns whether approach is lazy or not.
static int Hybrid_Storage_Manager< T >::parse_eps_map | ( | PGresult * | res, | |
int | index, | |||
key & | k, | |||
double & | eps | |||
) | [inline, static, private] |
void Hybrid_Storage_Manager< T >::resort | ( | struct hazy_model & | m | ) | [virtual] |
Makes a resort to reorganize entities according to their epsilon values.
[in] | m | hazy model that we use to re-calculate epsllon values |
Implements Storage_Manager< T >.
_tbuffer Hybrid_Storage_Manager< T >::_buffer [private] |
int Hybrid_Storage_Manager< T >::_buffer_size [private] |
buffer size
Hazy_Database* Hybrid_Storage_Manager< T >::_conn [private] |
Database connection.
Ondisk_Storage_Manager<T>* Hybrid_Storage_Manager< T >::_disk [private] |
Ondisk_Storage_Manager is used.
_tentitymap Hybrid_Storage_Manager< T >::_entity_map [private] |
_tepsmap Hybrid_Storage_Manager< T >::_epsmap [private] |
bool Hybrid_Storage_Manager< T >::_epsused [private] |
bool Hybrid_Storage_Manager< T >::_force_monotone [private] |
This is required for the theory to hold.
bool Hybrid_Storage_Manager< T >::_lazy [private] |
double Hybrid_Storage_Manager< T >::eps_high [private] |
low & high eps
double Hybrid_Storage_Manager< T >::eps_low [private] |
_tbuffer_it Hybrid_Storage_Manager< T >::high_water_it [private] |
int Hybrid_Storage_Manager< T >::log_iu_buffer_hit [private] |
int Hybrid_Storage_Manager< T >::log_iu_buffer_miss [private] |
int Hybrid_Storage_Manager< T >::log_se_buffer_hit [private] |
int Hybrid_Storage_Manager< T >::log_se_buffer_miss [private] |
int Hybrid_Storage_Manager< T >::log_se_eps_hit [private] |
Logging variables Single Entity Counters.
int Hybrid_Storage_Manager< T >::log_se_eps_miss [private] |
_tbuffer_it Hybrid_Storage_Manager< T >::low_water_it [private] |
low & high water iterators
prepared_stmt Hybrid_Storage_Manager< T >::query_buffer_fill [private] |
prepared statements
prepared_stmt Hybrid_Storage_Manager< T >::query_eps_exec [private] |
int Hybrid_Storage_Manager< T >::unique_id_for_ps [private] |
unique id for prepared statements in order to prevent any conflict in the same database connection, there cannot be prepared statements with exact same name