#include <ondisk_storage_manager.h>
Inheritance diagram for Ondisk_Storage_Manager< T >:
Public Member Functions | |
Ondisk_Storage_Manager (Hazy_Database *db_conn, struct ondisk_storage_spec *spec) | |
Constructor that takes database connector and ondisk storage spec. | |
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. | |
virtual void | insertEntity (struct hazy_model &m, key e, T f)=0 |
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. | |
~Ondisk_Storage_Manager () | |
Destructor. | |
Protected Member Functions | |
void | updateInternalTable (struct hazy_model &m) |
Updates internal table from given model and bias First, the internal table is clustered on new epsilon values based on the hazy model. | |
void | update_disk_region (struct hazy_model &hm, double lower_bound, double upper_bound, double &waste_time) |
This function updates a disk region The hybrid calls it (via a friend method) : *** This is factored this way for optimization. | |
void | rescan (struct hazy_model &hm) |
Helper function for naive eager that recreates the external table. | |
void | setup (bool bRebuild, struct hazy_model &hm) |
Does initial setup If bRebuild is true, recreates all prepared statements and tables. | |
Protected Attributes | |
std::string | external_table_name |
External results table name for on-disk. | |
std::string | hazy_intermediate_table_name |
Internal results table for on-disk. | |
hazy_model::strategy | _strategy |
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 |
Ondisk_Storage_Manager< T >::Ondisk_Storage_Manager | ( | Hazy_Database * | db_conn, | |
struct ondisk_storage_spec * | spec | |||
) |
Constructor that takes database connector and ondisk storage spec.
[in] | db_conn | database connection |
[in] | spec | ondisk_storage_spec |
Ondisk_Storage_Manager< T >::~Ondisk_Storage_Manager | ( | ) |
Destructor.
void Ondisk_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 Ondisk_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 Ondisk_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 >.
virtual void Ondisk_Storage_Manager< T >::insertEntity | ( | struct hazy_model & | m, | |
key | e, | |||
T | f | |||
) | [pure 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 >.
Implemented in Ondisk_Storage_Manager_Dense, and Ondisk_Storage_Manager_Sparse.
void Ondisk_Storage_Manager< T >::rescan | ( | struct hazy_model & | hm | ) | [protected] |
Helper function for naive eager that recreates the external table.
[in] | hm | hazy model |
void Ondisk_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 >.
void Ondisk_Storage_Manager< T >::setup | ( | bool | bRebuild, | |
struct hazy_model & | hm | |||
) | [protected] |
Does initial setup If bRebuild is true, recreates all prepared statements and tables.
Then, fills internal and external tables by using hazy model
[in] | bRebuild | If this is true, then all tables and prepared statements are created |
[in] | hm | hazy model |
void Ondisk_Storage_Manager< T >::update_disk_region | ( | struct hazy_model & | hm, | |
double | lower_bound, | |||
double | upper_bound, | |||
double & | waste_time | |||
) | [protected] |
This function updates a disk region The hybrid calls it (via a friend method) : *** This is factored this way for optimization.
The input is a model and X = [lower_bound, upper_bound] NB: The region is inclusive. for each tuple t s.t. t.eps in X, we reclassify them with the model.
[in] | hm | hazy model |
[in] | lower_bound | low water |
[in] | upper_bound | high water |
[out] | waste_time |
void Ondisk_Storage_Manager< T >::updateInternalTable | ( | struct hazy_model & | m | ) | [protected] |
Updates internal table from given model and bias First, the internal table is clustered on new epsilon values based on the hazy model.
Then necessary indexes are created
[in] | m | hazy_model |
hazy_model::strategy Ondisk_Storage_Manager< T >::_strategy [protected] |
std::string Ondisk_Storage_Manager< T >::external_table_name [protected] |
External results table name for on-disk.
std::string Ondisk_Storage_Manager< T >::hazy_intermediate_table_name [protected] |
Internal results table for on-disk.
int Ondisk_Storage_Manager< T >::unique_id_for_ps [protected] |
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