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:
parent
820af05567
commit
03e6449d46
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user