Skip to content

Commit

Permalink
introduce released field in DB, so released workspaces can be disting…
Browse files Browse the repository at this point in the history
…uished from expired ones

(see branch new_release for parts in ws_expirer that use this)
  • Loading branch information
holgerBerger committed Apr 14, 2020
1 parent 7b02251 commit aaaba8a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ void Workspace::release(string name) {

// set expiration to now so it gets deleted earlier after beeing released
dbentry.setexpiration(time(NULL));
// set released flag so released workspaces can be distinguished from expired ones
dbentry.setreleased(time(NULL));
dbentry.write_dbfile();

string dbtargetname = fs::path(dbfilename).parent_path().string() + "/" +
Expand Down
2 changes: 1 addition & 1 deletion src/ws_release.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int main(int argc, char **argv) {
// get workspace object
Workspace ws(WS_Release, opt, duration, filesystem);

// allocate workspace
// release workspace
ws.release(name);

}
Expand Down
5 changes: 4 additions & 1 deletion src/wsdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ void WsDB::write_dbfile()
if (group.length()>0) {
entry["group"] = group;
}
entry["comment"] = comment;
if (released > 0) {
entry["released"] = released;
}
entry["comment"] = comment;
Workspace::raise_cap(CAP_DAC_OVERRIDE);
#ifdef SETUID
// for filesystem with root_squash, we need to be DB user here
Expand Down
13 changes: 9 additions & 4 deletions src/wsdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class WsDB {
int reminder;
string mailaddress;
string group;
string comment;
string comment;
long released;

void read_dbfile();

Expand All @@ -83,9 +84,13 @@ class WsDB {
return expiration;
}

void setexpiration(long int expiration_) {
expiration = expiration_;
}
void setexpiration(long int expiration_) {
expiration = expiration_;
}

void setreleased(long int released_) {
released = released_;
}

int getextension() {
return extensions;
Expand Down

0 comments on commit aaaba8a

Please sign in to comment.