Fix bugs introduced by flow states.

pull/1/head
Ivan Olexyn 5 years ago
parent 5711f03b44
commit 462bd11a75

@ -18,7 +18,7 @@ public class Main {
SyncEntity syncEntity = new SyncEntity("test");
syncEntity.addDirectory("/home/user/test/a");
syncEntity.addDirectory("/home/user/test/b");
syncEntity.addDirectory("/home/user/test/c");
//syncEntity.addDirectory("/home/user/test/c");
int br1 = 0;
@ -32,6 +32,10 @@ public class Main {
syncDirectory.updateStateFileNew();
syncDirectory.updatePoolNew();
syncDirectory.getListCreated();
syncDirectory.getListDeleted();
//
syncDirectory.doSyncOps();
@ -44,8 +48,11 @@ public class Main {
// -> create newFile -> update StateFileNew-> getListCreated contains newFile -> addToMapCreated -> create copies as needed -> updateStateFileOld -> OK
// -> create newFile -> update StateFileOld -> getListDeletd contains newFile -> VERY BAD
//
syncDirectory.updateStateFileNew();
syncDirectory.updatePoolNew();
syncDirectory.updateStateFileOld();
syncDirectory.updatePoolBoth();
syncDirectory.updatePoolOld();

@ -110,7 +110,7 @@ public class SyncDirectory {
public Map<String, File> getPoolOld() {
if (poolOld.isEmpty()) {
updatePoolBoth();
updatePoolOld();
}
return poolOld;
}
@ -118,8 +118,8 @@ public class SyncDirectory {
/**
* UPDATE PoolOld FROM contents of StateFileOld.
*/
public void updatePoolBoth() {
poolNew = tools.fileToPool(getStateFileNew(), "all");
public void updatePoolOld() {
poolOld = tools.fileToPool(getStateFileOld(), "all");
}
@ -152,7 +152,7 @@ public class SyncDirectory {
}
public void updateListCreated(){
if (state.equals(""))
listCreated = tools.mapMinus(getPoolNew(), getPoolOld());
}
@ -180,7 +180,7 @@ public class SyncDirectory {
for (File createdFile : this.getListCreated()) {
for (File createdFile : listCreated) {
for (Map.Entry<String, SyncDirectory> otherEntry : syncEntity.syncDirectories.entrySet()) {
SyncDirectory otherSyncDirectory = otherEntry.getValue();
@ -210,7 +210,7 @@ public class SyncDirectory {
}
//
for (File deletedFile : this.getListDeleted()) {
for (File deletedFile : listDeleted) {
for (Map.Entry<String, SyncDirectory> otherEntry : syncEntity.syncDirectories.entrySet()) {
SyncDirectory otherSyncDirectory = otherEntry.getValue();

Loading…
Cancel
Save