1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

Bug #1086: Re-implement cache key for User, Group and Host pools

This commit is contained in:
Carlos Martín 2012-01-25 12:26:46 +01:00
parent 820af05567
commit 03e6449d46
4 changed files with 43 additions and 1 deletions

View File

@ -93,9 +93,23 @@ public:
*/
Group * get(const string& name, bool lock)
{
// The owner is set to -1, because it is not used in the key() method
return static_cast<Group *>(PoolSQL::get(name,-1,lock));
};
/**
* Generate an index key for the object
* @param name of the object
* @param uid owner of the object, only used if needed
*
* @return the key, a string
*/
string key(const string& name, int uid)
{
// Name is enough key because Groups can't repeat names.
return name;
};
/** Update a particular Group
* @param user pointer to Group
* @return 0 on success

View File

@ -79,9 +79,23 @@ public:
*/
Host * get(string name, bool lock)
{
// The owner is set to -1, because it is not used in the key() method
return static_cast<Host *>(PoolSQL::get(name,-1,lock));
};
/**
* Generate an index key for the object
* @param name of the object
* @param uid owner of the object, only used if needed
*
* @return the key, a string
*/
string key(const string& name, int uid)
{
// Name is enough key because Hosts can't repeat names.
return name;
};
/**
* Bootstraps the database table(s) associated to the Host pool
* @return 0 on success

View File

@ -273,7 +273,7 @@ private:
*
* @return the key, a string
*/
string key(const string& name, int uid)
virtual string key(const string& name, int uid)
{
ostringstream key;

View File

@ -80,9 +80,23 @@ public:
*/
User * get(string name, bool lock)
{
// The owner is set to -1, because it is not used in the key() method
return static_cast<User *>(PoolSQL::get(name,-1,lock));
};
/**
* Generate an index key for the object
* @param name of the object
* @param uid owner of the object, only used if needed
*
* @return the key, a string
*/
string key(const string& name, int uid)
{
// Name is enough key because Users can't repeat names.
return name;
};
/** Update a particular User
* @param user pointer to User
* @return 0 on success