-
Notifications
You must be signed in to change notification settings - Fork 871
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: moved some inner types of write cache to own files
- Loading branch information
Showing
12 changed files
with
658 additions
and
548 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/DeleteFileTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.orientechnologies.orient.core.storage.cache.local; | ||
|
||
import com.orientechnologies.common.util.ORawPair; | ||
import java.util.concurrent.Callable; | ||
|
||
final class DeleteFileTask implements Callable<ORawPair<String, String>> { | ||
/** */ | ||
private final OWOWCache cache; | ||
|
||
private final long externalFileId; | ||
|
||
DeleteFileTask(OWOWCache owowCache, long externalFileId) { | ||
cache = owowCache; | ||
this.externalFileId = externalFileId; | ||
} | ||
|
||
@Override | ||
public ORawPair<String, String> call() throws Exception { | ||
return cache.executeDeleteFile(externalFileId); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...c/main/java/com/orientechnologies/orient/core/storage/cache/local/ExclusiveFlushTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.orientechnologies.orient.core.storage.cache.local; | ||
|
||
import java.util.concurrent.CountDownLatch; | ||
|
||
final class ExclusiveFlushTask implements Runnable { | ||
/** */ | ||
private final OWOWCache cache; | ||
|
||
private final CountDownLatch cacheBoundaryLatch; | ||
private final CountDownLatch completionLatch; | ||
|
||
ExclusiveFlushTask( | ||
OWOWCache owowCache, | ||
final CountDownLatch cacheBoundaryLatch, | ||
final CountDownLatch completionLatch) { | ||
cache = owowCache; | ||
this.cacheBoundaryLatch = cacheBoundaryLatch; | ||
this.completionLatch = completionLatch; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
cache.executeFlush(cacheBoundaryLatch, completionLatch); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/FileFlushTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.orientechnologies.orient.core.storage.cache.local; | ||
|
||
import java.util.Collection; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.concurrent.Callable; | ||
|
||
final class FileFlushTask implements Callable<Void> { | ||
/** */ | ||
private final OWOWCache cache; | ||
|
||
private final Set<Integer> fileIdSet; | ||
|
||
FileFlushTask(OWOWCache owowCache, final Collection<Integer> fileIds) { | ||
cache = owowCache; | ||
this.fileIdSet = new HashSet<>(fileIds); | ||
} | ||
|
||
@Override | ||
public Void call() throws Exception { | ||
return cache.executeFileFlush(this.fileIdSet); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../main/java/com/orientechnologies/orient/core/storage/cache/local/FindMinDirtySegment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.orientechnologies.orient.core.storage.cache.local; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
final class FindMinDirtySegment implements Callable<Long> { | ||
/** */ | ||
private final OWOWCache cache; | ||
|
||
/** @param owowCache */ | ||
FindMinDirtySegment(OWOWCache owowCache) { | ||
cache = owowCache; | ||
} | ||
|
||
@Override | ||
public Long call() { | ||
return cache.executeFindDirtySegment(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...main/java/com/orientechnologies/orient/core/storage/cache/local/FlushTillSegmentTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.orientechnologies.orient.core.storage.cache.local; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
final class FlushTillSegmentTask implements Callable<Void> { | ||
/** */ | ||
private final OWOWCache cache; | ||
|
||
private final long segmentId; | ||
|
||
FlushTillSegmentTask(OWOWCache owowCache, final long segmentId) { | ||
cache = owowCache; | ||
this.segmentId = segmentId; | ||
} | ||
|
||
@Override | ||
public Void call() throws Exception { | ||
return cache.executeFlushTillSegment(this.segmentId); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
.../src/main/java/com/orientechnologies/orient/core/storage/cache/local/NameFileIdEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.orientechnologies.orient.core.storage.cache.local; | ||
|
||
final class NameFileIdEntry { | ||
private final String name; | ||
private final int fileId; | ||
private final String fileSystemName; | ||
|
||
public NameFileIdEntry(final String name, final int fileId) { | ||
this.name = name; | ||
this.fileId = fileId; | ||
this.fileSystemName = name; | ||
} | ||
|
||
public NameFileIdEntry(final String name, final int fileId, final String fileSystemName) { | ||
this.name = name; | ||
this.fileId = fileId; | ||
this.fileSystemName = fileSystemName; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
|
||
final NameFileIdEntry that = (NameFileIdEntry) o; | ||
|
||
if (getFileId() != that.getFileId()) { | ||
return false; | ||
} | ||
if (!getName().equals(that.getName())) { | ||
return false; | ||
} | ||
return getFileSystemName().equals(that.getFileSystemName()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = getName().hashCode(); | ||
result = 31 * result + getFileId(); | ||
result = 31 * result + getFileSystemName().hashCode(); | ||
return result; | ||
} | ||
|
||
String getName() { | ||
return name; | ||
} | ||
|
||
int getFileId() { | ||
return fileId; | ||
} | ||
|
||
String getFileSystemName() { | ||
return fileSystemName; | ||
} | ||
} |
Oops, something went wrong.