Base Framework
testsuite/Quota.cpp
/***************************************************************************
The Base Framework
A framework for developing platform independent applications
See COPYRIGHT.txt for details.
This framework is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For the licensing terms refer to the file 'LICENSE'.
***************************************************************************/
#include <base/Application.h>
#include <base/concurrency/Process.h>
#include <base/filesystem/FileSystem.h>
#include <base/TypeInfo.h>
#include <base/security/User.h>
using namespace com::azure::dev::base;
class QuotaApplication : public Application {
private:
static const unsigned int MAJOR_VERSION = 1;
static const unsigned int MINOR_VERSION = 0;
public:
QuotaApplication()
: Application("Quota")
{
}
void main()
{
fout << getFormalName() << " version "
<< MAJOR_VERSION << '.' << MINOR_VERSION << EOL
<< "The Base Framework (Test Suite)" << EOL
<< ENDL;
String home = user.getHomeFolder();
fout << "User: " << user.getName() << ENDL;
fout << "Home: " << home << ENDL;
try {
quota = FileSystem::getQuota(home, user);
} catch (FileSystemException& e) {
ferr << "Error: " << e << ENDL;
setExitCode(EXIT_CODE_ERROR);
return;
}
fout << "Hard limit: " << quota.hardLimit << EOL
<< "Soft limit: " << quota.softLimit << EOL
<< "Current usage: " << quota.currentUsage << ENDL;
}
};
APPLICATION_STUB(QuotaApplication);
FileSystem::Quota::currentUsage
uint64 currentUsage
Definition: FileSystem.h:179
FileSystem::Quota::softLimit
uint64 softLimit
Definition: FileSystem.h:175
User::getName
String getName(bool fallback=true) const
FileSystem::Quota
Definition: FileSystem.h:171
FileSystem::getQuota
static Quota getQuota(const String &path, Trustee trustee)
String
String.
Definition: String.h:102
Application
Application.
Definition: Application.h:53
FileSystemException
File system exception.
Definition: FileSystemException.h:28
FileSystem::Quota::hardLimit
uint64 hardLimit
Definition: FileSystem.h:177
User
User trustee.
Definition: User.h:34
User::getCurrentUser
static User getCurrentUser()
User::getHomeFolder
String getHomeFolder() const