Skip to content

Commit f655b1e

Browse files
FlorentinDs1ck
andcommitted
Use singular in count methods on catalogs
F.i. `graphStoreCount` Co-authored-by: Martin Junghanns <martin.junghanns@neotechnology.com>
1 parent 9f30e9a commit f655b1e

File tree

10 files changed

+26
-26
lines changed

10 files changed

+26
-26
lines changed

core/src/main/java/org/neo4j/gds/core/loading/GraphStoreCatalog.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ public static boolean exists(String username, DatabaseId databaseId, String grap
171171
return getUserCatalog(username).exists(UserCatalog.UserCatalogKey.of(databaseId, graphName));
172172
}
173173

174-
public static int graphStoresCount() {
174+
public static int graphStoreCount() {
175175
return userCatalogs
176176
.values()
177177
.stream()
178178
.mapToInt(userCatalog -> userCatalog.getGraphStores().values().size())
179179
.sum();
180180
}
181181

182-
public static int graphStoresCount(DatabaseId databaseId) {
182+
public static int graphStoreCount(DatabaseId databaseId) {
183183
return userCatalogs
184184
.values()
185185
.stream()
@@ -188,7 +188,7 @@ public static int graphStoresCount(DatabaseId databaseId) {
188188
}
189189

190190
public static boolean isEmpty() {
191-
return graphStoresCount() == 0;
191+
return graphStoreCount() == 0;
192192
}
193193

194194
public static Optional<Map<String, Object>> getDegreeDistribution(

core/src/main/java/org/neo4j/gds/core/utils/progress/EmptyTaskStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public boolean isEmpty() {
5656
}
5757

5858
@Override
59-
public long tasksCount() {
59+
public long taskCount() {
6060
return 0;
6161
}
6262

core/src/main/java/org/neo4j/gds/core/utils/progress/GlobalTaskStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public boolean isEmpty() {
8989
}
9090

9191
@Override
92-
public long tasksCount() {
92+
public long taskCount() {
9393
return registeredTasks.values().stream().mapToLong(Map::size).sum();
9494
}
9595
}

core/src/main/java/org/neo4j/gds/core/utils/progress/TaskStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ public interface TaskStore {
4141

4242
boolean isEmpty();
4343

44-
long tasksCount();
44+
long taskCount();
4545
}

core/src/test/java/org/neo4j/gds/core/loading/GraphStoreCatalogTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,42 +345,42 @@ void removeAsAdminReturnsOnlyTheGraphFromTheOverrideEvenIfAGraphFromADifferentUs
345345

346346
@Test
347347
void graphStoresCount() {
348-
assertEquals(0, GraphStoreCatalog.graphStoresCount(DATABASE_ID));
348+
assertEquals(0, GraphStoreCatalog.graphStoreCount(DATABASE_ID));
349349
GraphStoreCatalog.set(CONFIG, graphStore);
350-
assertEquals(1, GraphStoreCatalog.graphStoresCount(DATABASE_ID));
350+
assertEquals(1, GraphStoreCatalog.graphStoreCount(DATABASE_ID));
351351
GraphStoreCatalog.remove(
352352
CatalogRequest.of(USER_NAME, DATABASE_ID),
353353
GRAPH_NAME,
354354
graphStoreWithConfig -> {},
355355
true
356356
);
357-
assertEquals(0, GraphStoreCatalog.graphStoresCount(DATABASE_ID));
357+
assertEquals(0, GraphStoreCatalog.graphStoreCount(DATABASE_ID));
358358
}
359359

360360
@Test
361361
void graphStoresCountAcrossUsers() {
362-
assertEquals(0, GraphStoreCatalog.graphStoresCount());
362+
assertEquals(0, GraphStoreCatalog.graphStoreCount());
363363
GraphStoreCatalog.set(CONFIG, graphStore);
364-
assertEquals(1, GraphStoreCatalog.graphStoresCount());
364+
assertEquals(1, GraphStoreCatalog.graphStoreCount());
365365
GraphStoreCatalog.set(GraphProjectFromStoreConfig.emptyWithName("bob", GRAPH_NAME), graphStore);
366-
assertEquals(2, GraphStoreCatalog.graphStoresCount());
366+
assertEquals(2, GraphStoreCatalog.graphStoreCount());
367367
GraphStoreCatalog.set(GraphProjectFromStoreConfig.emptyWithName("clive", GRAPH_NAME), graphStore);
368-
assertEquals(3, GraphStoreCatalog.graphStoresCount());
368+
assertEquals(3, GraphStoreCatalog.graphStoreCount());
369369
GraphStoreCatalog.remove(
370370
CatalogRequest.of(USER_NAME, DATABASE_ID),
371371
GRAPH_NAME,
372372
graphStoreWithConfig -> {},
373373
true
374374
);
375-
assertEquals(2, GraphStoreCatalog.graphStoresCount());
375+
assertEquals(2, GraphStoreCatalog.graphStoreCount());
376376
}
377377

378378
@Test
379379
void removeAllLoadedGraphs() {
380380
GraphStoreCatalog.set(CONFIG, graphStore);
381-
assertEquals(1, GraphStoreCatalog.graphStoresCount(DATABASE_ID));
381+
assertEquals(1, GraphStoreCatalog.graphStoreCount(DATABASE_ID));
382382
GraphStoreCatalog.removeAllLoadedGraphs();
383-
assertEquals(0, GraphStoreCatalog.graphStoresCount(DATABASE_ID));
383+
assertEquals(0, GraphStoreCatalog.graphStoreCount(DATABASE_ID));
384384
}
385385

386386
@Test

core/src/test/java/org/neo4j/gds/core/utils/progress/GlobalTaskStoreTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ void shouldCountAcrossUsers() {
4848
var taskStore = new GlobalTaskStore();
4949
taskStore.store("a", new JobId(), Tasks.leaf("v"));
5050

51-
assertThat(taskStore.tasksCount()).isEqualTo(1);
51+
assertThat(taskStore.taskCount()).isEqualTo(1);
5252

5353
taskStore.store("b", new JobId(), Tasks.leaf("x"));
5454

55-
assertThat(taskStore.tasksCount()).isEqualTo(2);
55+
assertThat(taskStore.taskCount()).isEqualTo(2);
5656

5757
taskStore.store("b", new JobId(), Tasks.leaf("y"));
5858

59-
assertThat(taskStore.tasksCount()).isEqualTo(3);
59+
assertThat(taskStore.taskCount()).isEqualTo(3);
6060
}
6161
}

executor/src/main/java/org/neo4j/gds/executor/MemoryUsageValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private static void validateMemoryUsage(
130130
if (!GraphStoreCatalog.isEmpty()) {
131131
errorMessage.add(formatWithLocale(
132132
"Note: there are %s graphs currently loaded into memory.",
133-
GraphStoreCatalog.graphStoresCount()
133+
GraphStoreCatalog.graphStoreCount()
134134
));
135135
}
136136

model-catalog-api/src/main/java/org/neo4j/gds/core/model/ModelCatalog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <D, C extends ModelConfig, I extends ToMapConvertible> Model<D, C, I> get(
4444

4545
Stream<Model<?, ?, ?>> getAllModels();
4646

47-
long modelsCount();
47+
long modelCount();
4848

4949
boolean exists(String username, String modelName);
5050

open-model-catalog/src/main/java/org/neo4j/gds/core/model/OpenModelCatalog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public <D, C extends ModelConfig, I extends ToMapConvertible> Model<D, C, I> get
9393
}
9494

9595
@Override
96-
public long modelsCount() {
96+
public long modelCount() {
9797
return userCatalogs.values().stream().mapToLong(OpenUserCatalog::size).sum();
9898
}
9999

open-model-catalog/src/test/java/org/neo4j/gds/core/model/OpenModelCatalogTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,19 @@ void shouldCountModels() {
183183
Map::of
184184
);
185185

186-
assertThat(modelCatalog.modelsCount()).isEqualTo(0);
186+
assertThat(modelCatalog.modelCount()).isEqualTo(0);
187187

188188
modelCatalog.set(model1);
189189

190-
assertThat(modelCatalog.modelsCount()).isEqualTo(1);
190+
assertThat(modelCatalog.modelCount()).isEqualTo(1);
191191

192192
modelCatalog.set(model2);
193193

194-
assertThat(modelCatalog.modelsCount()).isEqualTo(2);
194+
assertThat(modelCatalog.modelCount()).isEqualTo(2);
195195

196196
modelCatalog.set(publicModel);
197197

198-
assertThat(modelCatalog.modelsCount()).isEqualTo(3);
198+
assertThat(modelCatalog.modelCount()).isEqualTo(3);
199199
}
200200

201201
@Test

0 commit comments

Comments
 (0)