private ArrayList<String> currentChanges = new ArrayList<String>();
public final Path dbFolder;
- public Path lastSessionDirectory;
- public Path workingDirectory;
+ private FileCache fileCache;
+ Path lastSessionDirectory;
+ Path workingDirectory;
public LRU<String, ClusterStreamChunk> streamLRU;
public LRU<Long, ChangeSetInfo> csLRU;
*
*/
- public ClusterManager(Path dbFolder) {
+ public ClusterManager(Path dbFolder, FileCache fileCache) {
this.dbFolder = dbFolder;
+ this.fileCache = fileCache;
}
public ArrayList<String> getChanges(long changeSetId) throws AcornAccessVerificationException, IllegalAcornStateException {
}
workingDirectory = dbFolder.resolve(Integer.toString(mainState.headDir));
- if (!Files.exists(workingDirectory)) {
- Files.createDirectories(workingDirectory);
- }
+ Files.createDirectories(workingDirectory);
cssi.updateWriteDirectory(workingDirectory);
Path readDir = dbFolder.resolve(parts[1]);
int offset = Integer.parseInt(parts[2]);
int length = Integer.parseInt(parts[3]);
- FileInfo info = new FileInfo(fileLRU, readDir, parts[0], offset, length);
+ FileInfo info = new FileInfo(fileLRU, fileCache, readDir, parts[0], offset, length);
fileLRU.map(info);
}
// Update chunks
Long revisionId = Long.parseLong(parts[0]);
int offset = Integer.parseInt(parts[2]);
int length = Integer.parseInt(parts[3]);
- ChangeSetInfo info = new ChangeSetInfo(csLRU, readDir, revisionId, offset, length);
+ ChangeSetInfo info = new ChangeSetInfo(csLRU, fileCache, readDir, revisionId, offset, length);
csLRU.map(info);
}
try {
ArrayList<String> csids = new ArrayList<String>(currentChanges);
currentChanges = new ArrayList<String>();
- new ChangeSetInfo(csLRU, changeSetId, data, csids);
+ new ChangeSetInfo(csLRU, fileCache, changeSetId, data, csids);
} catch (Throwable t) {
throw new IllegalAcornStateException(t);
} finally {
try {
info = fileLRU.get(key);
if (info == null) {
- info = new FileInfo(fileLRU, key, (int) (offset + size));
+ info = new FileInfo(fileLRU, fileCache, key, (int) (offset + size));
}
} catch (Throwable t) {
throw new IllegalAcornStateException(t);
public long getTailChangeSetId() {
return state.tailChangeSetId;
}
-
+
+ public FileCache getFileCache() {
+ return fileCache;
+ }
+
}