Skip to content
Snippets Groups Projects
Verified Commit 209c7c0c authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP version history

parent cd13d315
Branches
Tags
No related merge requests found
......@@ -28,8 +28,8 @@ jcs.region.BACKEND_JobRules.cacheattributes.MaxObjects=103
jcs.region.BACKEND_SparseEntities
jcs.region.BACKEND_SparseEntities.cacheattributes.MaxObjects=1002
jcs.region.BACKEND_RetrieveFullVersionInfo
jcs.region.BACKEND_RetrieveFullVersionInfo.cacheattributes.MaxObjects=1006
jcs.region.BACKEND_RetrieveVersionHistory
jcs.region.BACKEND_RetrieveVersionHistory.cacheattributes.MaxObjects=1006
# PAM UserSource Caching: Cached Items expire after 60 seconds if they are not requested (idle) and after 600 seconds max.
# PAM_UnixUserGroups
......
......@@ -70,5 +70,6 @@ public class InsertSparseEntity extends BackendTransaction {
});
this.entity.setId(e.id);
this.entity.setVersion(new Version(e.versionId));
this.entity.getVersion().setHead(true);
}
}
......@@ -54,6 +54,8 @@ public class RetrieveTransactionHistory extends RetrieveVersionHistory {
Version v = getVersion(getEntity().getVersion().getId());
v.setSuccessors(getSuccessors(v.getId(), true));
v.setPredecessors(getPredecessors(v.getId(), true));
v.setHead(v.getSuccessors().isEmpty());
v.setCompleteHistory(true);
return v;
}
}
......@@ -49,6 +49,7 @@ public class RetrieveVersionInfo extends RetrieveVersionHistory {
Version v = getVersion(getEntity().getVersion().getId());
v.setPredecessors(getPredecessors(v.getId(), false));
v.setSuccessors(getSuccessors(v.getId(), false));
v.setHead(v.getSuccessors().isEmpty());
return v;
}
}
......@@ -36,6 +36,8 @@ public class Version {
private List<Version> predecessors = null;
private List<Version> successors = null;
private UTCDateTime date = null;
private boolean isHead = false;
private boolean isCompleteHistory = false;
public Version(String id, long seconds, int nanos) {
this(id, UTCDateTime.UTCSeconds(seconds, nanos), null, null);
......@@ -109,4 +111,20 @@ public class Version {
public void setDate(Long timestamp) {
this.date = UTCDateTime.SystemMillisToUTCDateTime(timestamp);
}
public boolean isHead() {
return isHead;
}
public void setHead(boolean isHead) {
this.isHead = isHead;
}
public boolean isCompleteHistory() {
return isCompleteHistory;
}
public void setCompleteHistory(boolean isCompleteHistory) {
this.isCompleteHistory = isCompleteHistory;
}
}
......@@ -62,5 +62,11 @@ class VersionXMLSerializer {
if (version.getDate() != null) {
element.setAttribute("date", version.getDate().toDateTimeString(TimeZone.getDefault()));
}
if (version.isHead()) {
element.setAttribute("head", "true");
}
if (version.isCompleteHistory()) {
element.setAttribute("completeHistory", "true");
}
}
}
......@@ -202,6 +202,10 @@ public class Info extends AbstractObservable implements Observer, TransactionInt
}
dropOffBox = new File(FileSystem.getDropOffBox());
final Element info = new Element("Stats");
if (CaosDBServer.isDebugMode()) {
info.setAttribute("debug", "true");
}
final Element counts = new Element("counts");
counts.setAttribute("records", Integer.toString(recordsCount));
counts.setAttribute("properties", Integer.toString(propertiesCount));
......@@ -209,18 +213,16 @@ public class Info extends AbstractObservable implements Observer, TransactionInt
counts.setAttribute("files", Integer.toString(filesCount));
counts.setAttribute("fssize", fssize);
counts.setAttribute("tmpfiles", Integer.toString(tmpFilesCount));
if (CaosDBServer.isDebugMode()) {
counts.setAttribute("debug", "true");
}
final Element e = new Element("dropOffBox");
final Element dropOffBoxElem = new Element("dropOffBox");
if (dropOffBox.isDirectory()) {
if (dropOffBox.canRead()) {
if (tree) {
e.setAttribute("path", dropOffBox.getAbsolutePath());
e.addContent(getTree(dropOffBox.listFiles()));
dropOffBoxElem.setAttribute("path", dropOffBox.getAbsolutePath());
dropOffBoxElem.addContent(getTree(dropOffBox.listFiles()));
} else {
e.setAttribute("path", dropOffBox.getAbsolutePath());
e.addContent(getFlatList(dropOffBox.listFiles()));
dropOffBoxElem.setAttribute("path", dropOffBox.getAbsolutePath());
dropOffBoxElem.addContent(getFlatList(dropOffBox.listFiles()));
}
} else {
// TODO: return a message that the DropOffBox is not readable.
......@@ -230,7 +232,7 @@ public class Info extends AbstractObservable implements Observer, TransactionInt
// present.
}
info.addContent(counts);
info.addContent(e);
info.addContent(dropOffBoxElem);
return info;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment