Skip to content

Commit

Permalink
Refactor BackupStoreAccountControl to be for a specific account ID
Browse files Browse the repository at this point in the history
This allows other BackupAccountControl implementations to implement the same
interface without needing to support account IDs, which are very
store-specific.
  • Loading branch information
qris committed Jul 23, 2017
1 parent 6fc2a7e commit 5148e0f
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 165 deletions.
20 changes: 9 additions & 11 deletions bin/bbstoreaccounts/bbstoreaccounts.cpp
Expand Up @@ -175,8 +175,7 @@ int main(int argc, const char *argv[])
argv++;
argc--;


BackupStoreAccountControl control(*config, machineReadableOutput);
BackupStoreAccountControl control(*config, id, machineReadableOutput);

// Now do the command.
if(command == "create")
Expand All @@ -200,12 +199,12 @@ int main(int argc, const char *argv[])
control.CheckSoftHardLimits(softlimit, hardlimit);

// Create the account...
return control.CreateAccount(id, discnum, softlimit, hardlimit);
return control.CreateAccount(discnum, softlimit, hardlimit);
}
else if(command == "info")
{
// Print information on this account
return control.PrintAccountInfo(id);
return control.PrintAccountInfo();
}
else if(command == "enabled")
{
Expand All @@ -230,7 +229,7 @@ int main(int argc, const char *argv[])
return PrintUsage();
}

return control.SetAccountEnabled(id, enabled);
return control.SetAccountEnabled(enabled);
}
else if(command == "setlimit")
{
Expand All @@ -241,7 +240,7 @@ int main(int argc, const char *argv[])
return 1;
}

return control.SetLimit(id, argv[0], argv[1]);
return control.SetLimit(argv[0], argv[1]);
}
else if(command == "name")
{
Expand All @@ -251,8 +250,7 @@ int main(int argc, const char *argv[])
BOX_ERROR("name command requires a new name.");
return 1;
}

return control.SetAccountName(id, argv[0]);
return control.SetAccountName(argv[0]);
}
else if(command == "delete")
{
Expand All @@ -262,7 +260,7 @@ int main(int argc, const char *argv[])
{
askForConfirmation = false;
}
return control.DeleteAccount(id, askForConfirmation);
return control.DeleteAccount(askForConfirmation);
}
else if(command == "check")
{
Expand All @@ -288,11 +286,11 @@ int main(int argc, const char *argv[])
}

// Check the account
return control.CheckAccount(id, fixErrors, quiet);
return control.CheckAccount(fixErrors, quiet);
}
else if(command == "housekeep")
{
return control.HousekeepAccountNow(id);
return control.HousekeepAccountNow();
}
else
{
Expand Down

0 comments on commit 5148e0f

Please sign in to comment.