Skip to content

Commit be7ffb3

Browse files
Rename 'Glob' -> 'Pattern' in FileNamingScheme
1 parent 66dab66 commit be7ffb3

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

util-state/src/main/java/io/activej/state/file/FileNamingScheme.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ default R firstRevision() {
1414
return nextRevision(null);
1515
}
1616

17-
Pattern snapshotGlob();
17+
Pattern snapshotPattern();
1818

1919
String encodeSnapshot(R revision);
2020

2121
@Nullable R decodeSnapshot(String filename) throws IOException;
2222

23-
Pattern diffGlob();
23+
Pattern diffPattern();
2424

2525
String encodeDiff(R from, R to);
2626

util-state/src/main/java/io/activej/state/file/FileNamingSchemes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public R nextRevision(@Nullable R previousRevision) {
119119
}
120120

121121
@Override
122-
public Pattern snapshotGlob() {
122+
public Pattern snapshotPattern() {
123123
return Pattern.compile(Pattern.quote(prefix) + "[0-9]+" + Pattern.quote(suffix));
124124
}
125125

@@ -137,7 +137,7 @@ public String encodeSnapshot(R revision) {
137137
}
138138

139139
@Override
140-
public Pattern diffGlob() {
140+
public Pattern diffPattern() {
141141
if (!hasDiffsSupport()) throw new UnsupportedOperationException();
142142
return Pattern.compile(Pattern.quote(diffPrefix) + "[0-9]+" + Pattern.quote(diffSeparator) + "[0-9]+" + Pattern.quote(diffSuffix));
143143
}

util-state/src/main/java/io/activej/state/file/FileStateManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public R newRevision() throws IOException {
155155

156156
@Override
157157
public @Nullable R getLastSnapshotRevision() throws IOException {
158-
Pattern pattern = fileNamingScheme.snapshotGlob();
158+
Pattern pattern = fileNamingScheme.snapshotPattern();
159159
Map<String, FileMetadata> list = fileSystem.list("*");
160160
R best = null;
161161
for (String s : list.keySet()) {
@@ -172,7 +172,7 @@ public R newRevision() throws IOException {
172172
@Override
173173
public @Nullable R getLastDiffRevision(R currentRevision) throws IOException {
174174
if (!hasDiffsSupport()) throw new UnsupportedOperationException();
175-
Pattern pattern = fileNamingScheme.diffGlob();
175+
Pattern pattern = fileNamingScheme.diffPattern();
176176
Map<String, FileMetadata> list = fileSystem.list("*");
177177
R best = null;
178178
for (String s : list.keySet()) {
@@ -254,7 +254,7 @@ public void save(T state, R revision) throws IOException {
254254

255255
private void doSave(T state, R revision) throws IOException {
256256
if (hasDiffsSupport() && maxSaveDiffs != 0) {
257-
Pattern pattern = fileNamingScheme.snapshotGlob();
257+
Pattern pattern = fileNamingScheme.snapshotPattern();
258258
Map<String, FileMetadata> filenames = fileSystem.list("*");
259259
PriorityQueue<R> top = new PriorityQueue<>(maxSaveDiffs);
260260
for (var filename : filenames.keySet()) {
@@ -317,7 +317,7 @@ private void safeUpload(String filename, StreamOutputConsumer consumer) throws I
317317

318318
public void cleanup(int maxRevisions) throws IOException {
319319
Map<String, FileMetadata> filenames = fileSystem.list("**");
320-
Pattern snapshotPattern = fileNamingScheme.snapshotGlob();
320+
Pattern snapshotPattern = fileNamingScheme.snapshotPattern();
321321

322322
PriorityQueue<R> top = new PriorityQueue<>(maxRevisions);
323323
for (var filename : filenames.keySet()) {
@@ -330,7 +330,7 @@ public void cleanup(int maxRevisions) throws IOException {
330330
if (top.isEmpty()) return;
331331
R minRetainedRevision = top.poll();
332332
if (hasDiffsSupport()) {
333-
Pattern diffPattern = fileNamingScheme.diffGlob();
333+
Pattern diffPattern = fileNamingScheme.diffPattern();
334334
for (String filename : filenames.keySet()) {
335335
if (!diffPattern.matcher(filename).matches()) continue;
336336
FileNamingScheme.Diff<R> diff = fileNamingScheme.decodeDiff(filename);

0 commit comments

Comments
 (0)