This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch simplify-geometries
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 0b7c265cb701c25c9616f36e4f7746e9eb49847a
Author: Bertil Chapuis <[email protected]>
AuthorDate: Tue Jan 10 23:22:29 2023 +0100

    Make the the AppendOnlyStore a Collection
---
 .../OpenStreetMapGeometriesBenchmark.java          |  6 +--
 .../apache/baremaps/collection/IndexedLongMap.java | 10 ++---
 .../baremaps/collection/LongOpenHashMap.java       | 22 +++++-----
 .../collection/SortedLongVariableSizeDataMap.java  | 16 +++----
 ...endOnlyStore.java => AppendOnlyCollection.java} | 51 ++++++++++++++++++----
 .../collection/store/IndexedDataStore.java         | 10 ++---
 .../workflow/tasks/ImportOpenStreetMap.java        |  6 +--
 .../workflow/tasks/SimplifyOpenStreetMap.java      |  8 ++--
 .../baremaps/collection/AppendStoreTest.java       | 14 +++---
 .../apache/baremaps/collection/LongMapTest.java    |  6 +--
 .../collection/sort/ExternalMergeSortTest.java     |  4 +-
 .../database/database/ImportUpdateDataTest.java    |  6 +--
 .../database/ImportUpdateLiechtensteinTest.java    |  6 +--
 .../database/database/ImportUpdateMonacoTest.java  |  6 +--
 14 files changed, 103 insertions(+), 68 deletions(-)

diff --git 
a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
 
b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
index b5f5ee32..d0dcb2b0 100644
--- 
a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
+++ 
b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
@@ -29,7 +29,7 @@ import org.apache.baremaps.collection.LongMap;
 import org.apache.baremaps.collection.LongOpenHashMap;
 import org.apache.baremaps.collection.memory.MappedMemory;
 import org.apache.baremaps.collection.memory.OnHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.type.CoordinateDataType;
 import org.apache.baremaps.collection.type.LongListDataType;
 import org.apache.baremaps.openstreetmap.model.Node;
@@ -77,9 +77,9 @@ public class OpenStreetMapGeometriesBenchmark {
   public void store() throws IOException {
     Path file = Files.createTempFile(Paths.get("."), "baremaps_", ".tmp");
     LongMap<Coordinate> coordinateMap = new LongOpenHashMap<>(
-        new AppendOnlyStore<>(new CoordinateDataType(), new 
MappedMemory(file)));
+        new AppendOnlyCollection<>(new CoordinateDataType(), new 
MappedMemory(file)));
     LongMap<List<Long>> referenceMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new LongListDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
LongListDataType(), new OnHeapMemory()));
     AtomicLong nodes = new AtomicLong(0);
     AtomicLong ways = new AtomicLong(0);
     AtomicLong relations = new AtomicLong(0);
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/IndexedLongMap.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/IndexedLongMap.java
index 621d1ab7..ff5f03ae 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/IndexedLongMap.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/IndexedLongMap.java
@@ -14,28 +14,28 @@ package org.apache.baremaps.collection;
 
 
 
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 
 public class IndexedLongMap<T> implements LongMap<T> {
 
   private final LongLongMap index;
 
-  private final AppendOnlyStore<T> store;
+  private final AppendOnlyCollection<T> store;
 
-  public IndexedLongMap(LongLongMap index, AppendOnlyStore<T> store) {
+  public IndexedLongMap(LongLongMap index, AppendOnlyCollection<T> store) {
     this.index = index;
     this.store = store;
   }
 
   @Override
   public void put(long key, T value) {
-    var position = store.add(value);
+    var position = store.append(value);
     index.put(key, position);
   }
 
   @Override
   public T get(long idx) {
     var position = index.get(idx);
-    return store.get(position);
+    return store.read(position);
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/LongOpenHashMap.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/LongOpenHashMap.java
index 5c91d21f..a120095c 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/LongOpenHashMap.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/LongOpenHashMap.java
@@ -19,10 +19,10 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 
 /**
- * A map of data backed by a {@link AppendOnlyStore} and whose keys are stored 
in an
+ * A map of data backed by a {@link AppendOnlyCollection} and whose keys are 
stored in an
  * {@link Long2LongOpenHashMap}.
  *
  * <p>
@@ -34,26 +34,26 @@ import org.apache.baremaps.collection.store.AppendOnlyStore;
 public class LongOpenHashMap<T> implements LongMap<T>, Map<Long, T> {
 
   private final Map<Long, Long> index;
-  private final AppendOnlyStore<T> store;
+  private final AppendOnlyCollection<T> store;
 
-  public LongOpenHashMap(AppendOnlyStore<T> values) {
+  public LongOpenHashMap(AppendOnlyCollection<T> values) {
     this.index = new Long2LongOpenHashMap();
     this.store = values;
   }
 
-  public LongOpenHashMap(Map<Long, Long> index, AppendOnlyStore<T> store) {
+  public LongOpenHashMap(Map<Long, Long> index, AppendOnlyCollection<T> store) 
{
     this.index = index;
     this.store = store;
   }
 
   @Override
   public void put(long key, T value) {
-    index.put(key, store.add(value));
+    index.put(key, store.append(value));
   }
 
   @Override
   public T get(long key) {
-    return store.get(index.get(key));
+    return store.read(index.get(key));
   }
 
   @Override
@@ -79,13 +79,13 @@ public class LongOpenHashMap<T> implements LongMap<T>, 
Map<Long, T> {
   @Override
   public T get(Object key) {
     var position = index.get(key);
-    return store.get(position);
+    return store.read(position);
   }
 
   @Override
   public T put(Long key, T value) {
     var previous = get(key);
-    var position = store.add(value);
+    var position = store.append(value);
     index.put(key, position);
     return previous;
   }
@@ -114,14 +114,14 @@ public class LongOpenHashMap<T> implements LongMap<T>, 
Map<Long, T> {
 
   @Override
   public Collection<T> values() {
-    return 
index.values().stream().map(store::get).collect(Collectors.toList());
+    return 
index.values().stream().map(store::read).collect(Collectors.toList());
   }
 
   @Override
   public Set<Entry<Long, T>> entrySet() {
     return index.entrySet().stream().map(entry -> {
       var key = entry.getKey();
-      var value = store.get(entry.getValue());
+      var value = store.read(entry.getValue());
       return Map.entry(key, value);
     }).collect(Collectors.toSet());
   }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/SortedLongVariableSizeDataMap.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/SortedLongVariableSizeDataMap.java
index 03b9194b..bc4ed876 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/SortedLongVariableSizeDataMap.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/SortedLongVariableSizeDataMap.java
@@ -14,7 +14,7 @@ package org.apache.baremaps.collection;
 
 
 
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.store.DataStore;
 import org.apache.baremaps.collection.store.MemoryAlignedDataStore;
 import org.apache.baremaps.collection.type.LongDataType;
@@ -22,7 +22,7 @@ import org.apache.baremaps.collection.type.PairDataType;
 import org.apache.baremaps.collection.type.PairDataType.Pair;
 
 /**
- * A map of data backed by a {@link DataStore} for storing keys and a {@link 
AppendOnlyStore} for
+ * A map of data backed by a {@link DataStore} for storing keys and a {@link 
AppendOnlyCollection} for
  * storing values.
  *
  * <p>
@@ -35,11 +35,11 @@ public class SortedLongVariableSizeDataMap<T> implements 
LongMap<T> {
 
   private final DataStore<Long> offsets;
   private final DataStore<Pair<Long, Long>> keys;
-  private final AppendOnlyStore<T> values;
+  private final AppendOnlyCollection<T> values;
 
   private long lastChunk = -1;
 
-  public SortedLongVariableSizeDataMap(AppendOnlyStore<T> values) {
+  public SortedLongVariableSizeDataMap(AppendOnlyCollection<T> values) {
     this(
         new MemoryAlignedDataStore<>(new LongDataType()),
         new MemoryAlignedDataStore<>(new PairDataType<>(new LongDataType(), 
new LongDataType())),
@@ -47,7 +47,7 @@ public class SortedLongVariableSizeDataMap<T> implements 
LongMap<T> {
   }
 
   public SortedLongVariableSizeDataMap(DataStore<Pair<Long, Long>> keys,
-      AppendOnlyStore<T> values) {
+      AppendOnlyCollection<T> values) {
     this(
         new MemoryAlignedDataStore<>(new LongDataType()),
         keys,
@@ -56,7 +56,7 @@ public class SortedLongVariableSizeDataMap<T> implements 
LongMap<T> {
 
 
   public SortedLongVariableSizeDataMap(DataStore<Long> offsets, 
DataStore<Pair<Long, Long>> keys,
-      AppendOnlyStore<T> values) {
+      AppendOnlyCollection<T> values) {
     this.offsets = offsets;
     this.keys = keys;
     this.values = values;
@@ -72,7 +72,7 @@ public class SortedLongVariableSizeDataMap<T> implements 
LongMap<T> {
       }
       lastChunk = chunk;
     }
-    long position = values.add(value);
+    long position = values.append(value);
     keys.add(new Pair<>(key, position));
   }
 
@@ -96,7 +96,7 @@ public class SortedLongVariableSizeDataMap<T> implements 
LongMap<T> {
         hi = index - 1;
       } else {
         // found
-        return values.get(pair.right());
+        return values.read(pair.right());
       }
     }
     return null;
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/store/AppendOnlyStore.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/store/AppendOnlyCollection.java
similarity index 74%
rename from 
baremaps-core/src/main/java/org/apache/baremaps/collection/store/AppendOnlyStore.java
rename to 
baremaps-core/src/main/java/org/apache/baremaps/collection/store/AppendOnlyCollection.java
index a4a53b7e..3e471ae0 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/store/AppendOnlyStore.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/store/AppendOnlyCollection.java
@@ -17,6 +17,7 @@ package org.apache.baremaps.collection.store;
 import java.io.Closeable;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.AbstractCollection;
 import java.util.Iterator;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -28,7 +29,7 @@ import org.apache.baremaps.collection.type.DataType;
  * A data log backed by a {@link DataType} and a {@link Memory}. Elements are 
appended to the store
  * and can be accessed by their position in the {@link Memory}.
  */
-public class AppendOnlyStore<T> implements Iterable<T>, Closeable, Cleanable {
+public class AppendOnlyCollection<T> extends AbstractCollection<T> implements 
Closeable, Cleanable {
 
   private final DataType<T> dataType;
   private final Memory memory;
@@ -44,7 +45,7 @@ public class AppendOnlyStore<T> implements Iterable<T>, 
Closeable, Cleanable {
    * @param dataType the data type
    * @param memory the memory
    */
-  public AppendOnlyStore(DataType<T> dataType, Memory memory) {
+  public AppendOnlyCollection(DataType<T> dataType, Memory memory) {
     this.dataType = dataType;
     this.memory = memory;
     this.segmentSize = memory.segmentSize();
@@ -58,7 +59,7 @@ public class AppendOnlyStore<T> implements Iterable<T>, 
Closeable, Cleanable {
    * @param value the value
    * @return the position of the value in the memory.
    */
-  public long add(T value) {
+  public long append(T value) {
     int valueSize = dataType.size(value);
     if (valueSize > segmentSize) {
       throw new DataStoreException("The value is too big to fit in a segment");
@@ -89,7 +90,7 @@ public class AppendOnlyStore<T> implements Iterable<T>, 
Closeable, Cleanable {
    * @param position the position of the value
    * @return the value
    */
-  public T get(long position) {
+  public T read(long position) {
     long segmentIndex = position / segmentSize;
     long segmentOffset = position % segmentSize;
     ByteBuffer buffer = memory.segment((int) segmentIndex);
@@ -101,7 +102,7 @@ public class AppendOnlyStore<T> implements Iterable<T>, 
Closeable, Cleanable {
    *
    * @return the number of values
    */
-  public long size() {
+  public long sizeAsLong() {
     return size;
   }
 
@@ -117,11 +118,45 @@ public class AppendOnlyStore<T> implements Iterable<T>, 
Closeable, Cleanable {
     memory.close();
   }
 
+  /**
+   * {@inheritDoc}
+   */
   @Override
-  public Iterator<T> iterator() {
-    long offset = 0;
+  public boolean add(T value) {
+    append(value);
+    return true;
+  }
 
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public int size() {
+    return (int) Math.min(size, Integer.MAX_VALUE);
+  }
 
-    return null;
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public Iterator<T> iterator() {
+    return new Iterator<>() {
+
+      private long position = 0;
+
+      @Override
+      public boolean hasNext() {
+        return position < size;
+      }
+
+      @Override
+      public T next() {
+        long segmentIndex = position / segmentSize;
+        long segmentOffset = position % segmentSize;
+        ByteBuffer buffer = memory.segment((int) segmentIndex);
+        position += dataType.size(buffer, (int) segmentOffset);
+        return dataType.read(buffer, (int) segmentOffset);
+      }
+    };
   }
 }
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/store/IndexedDataStore.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/store/IndexedDataStore.java
index f570d51c..4ab1fae1 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/collection/store/IndexedDataStore.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/collection/store/IndexedDataStore.java
@@ -20,29 +20,29 @@ public class IndexedDataStore<T> implements DataStore<T> {
 
   private final MemoryAlignedDataStore<Long> index;
 
-  private final AppendOnlyStore<T> values;
+  private final AppendOnlyCollection<T> values;
 
-  public IndexedDataStore(MemoryAlignedDataStore<Long> index, 
AppendOnlyStore<T> values) {
+  public IndexedDataStore(MemoryAlignedDataStore<Long> index, 
AppendOnlyCollection<T> values) {
     this.index = index;
     this.values = values;
   }
 
   @Override
   public long add(T value) {
-    long position = values.add(value);
+    long position = values.append(value);
     return index.add(position);
   }
 
   @Override
   public void set(long index, T value) {
-    long position = values.add(value);
+    long position = values.append(value);
     this.index.set(index, position);
   }
 
   @Override
   public T get(long index) {
     long position = this.index.get(index);
-    return values.get(position);
+    return values.read(position);
   }
 
   @Override
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
index 6abc8d5c..08b5f71e 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
@@ -14,7 +14,7 @@ package org.apache.baremaps.workflow.tasks;
 
 import org.apache.baremaps.collection.*;
 import org.apache.baremaps.collection.memory.MappedMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.store.MemoryAlignedDataStore;
 import org.apache.baremaps.collection.type.LonLatDataType;
 import org.apache.baremaps.collection.type.LongDataType;
@@ -78,7 +78,7 @@ public record ImportOpenStreetMap(Path file, String database, 
Integer databaseSr
             new PairDataType<>(new LongDataType(), new LongDataType()),
             new MappedMemory(coordinatesKeysFile)
           ),
-          new AppendOnlyStore<>(
+          new AppendOnlyCollection<>(
             new LonLatDataType(),
             new MappedMemory(coordinatesValsFile)));
     }
@@ -91,7 +91,7 @@ public record ImportOpenStreetMap(Path file, String database, 
Integer databaseSr
           new PairDataType<>(new LongDataType(), new LongDataType()),
           new MappedMemory(referencesKeysDir)
         ),
-        new AppendOnlyStore<>(
+        new AppendOnlyCollection<>(
           new LongListDataType(),
           new MappedMemory(referencesValuesDir)));
 
diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/SimplifyOpenStreetMap.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/SimplifyOpenStreetMap.java
index 71245a3a..e3ddbfc2 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/SimplifyOpenStreetMap.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/SimplifyOpenStreetMap.java
@@ -31,7 +31,7 @@ import java.util.stream.Stream;
 import org.apache.baremaps.collection.*;
 import org.apache.baremaps.collection.memory.MappedMemory;
 import org.apache.baremaps.collection.memory.OffHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.store.MemoryAlignedDataStore;
 import org.apache.baremaps.collection.type.*;
 import org.apache.baremaps.openstreetmap.model.Element;
@@ -63,7 +63,7 @@ public record SimplifyOpenStreetMap(Path file, String 
database, Integer database
                                         new LongDataType(),
                                         new LongDataType()
                                 ), new MappedMemory(coordinatesKeysFile)),
-                        new AppendOnlyStore<>(
+                        new AppendOnlyCollection<>(
                                 new LonLatDataType(),
                                 new MappedMemory(coordinatesValsFile)));
 
@@ -76,13 +76,13 @@ public record SimplifyOpenStreetMap(Path file, String 
database, Integer database
                                         new LongDataType(),
                                         new LongDataType()
                                 ), new MappedMemory(referencesKeysFile)),
-                        new AppendOnlyStore<>(
+                        new AppendOnlyCollection<>(
                                 new LongListDataType(),
                                 new MappedMemory(referencesValuesFile)));
 
         var collection = new IndexedLongMap<>(
                 new LongLongMap(new OffHeapMemory()),
-                new AppendOnlyStore<>(new GeometryDataType(), new 
OffHeapMemory()));
+                new AppendOnlyCollection<>(new GeometryDataType(), new 
OffHeapMemory()));
 
 
 //        new PbfEntityReader(
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/AppendStoreTest.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/AppendStoreTest.java
index 8fc0956b..a42febea 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/AppendStoreTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/AppendStoreTest.java
@@ -17,7 +17,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import java.util.ArrayList;
 import java.util.Random;
 import org.apache.baremaps.collection.memory.OffHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.type.IntegerDataType;
 import org.apache.baremaps.collection.type.IntegerListDataType;
 import org.junit.jupiter.api.Test;
@@ -26,18 +26,18 @@ class AppendStoreTest {
 
   @Test
   void addFixedSizeData() {
-    var store = new AppendOnlyStore<>(new IntegerDataType(), new 
OffHeapMemory(1 << 10));
+    var store = new AppendOnlyCollection<>(new IntegerDataType(), new 
OffHeapMemory(1 << 10));
     for (int i = 0; i < 1 << 20; i++) {
-      assertEquals(i << 2, store.add(i));
+      assertEquals(i << 2, store.append(i));
     }
     for (int i = 0; i < 1 << 20; i++) {
-      assertEquals(i, store.get(i << 2));
+      assertEquals(i, store.read(i << 2));
     }
   }
 
   @Test
   void addVariableSizeValues() {
-    var store = new AppendOnlyStore<>(new IntegerListDataType(), new 
OffHeapMemory(1 << 10));
+    var store = new AppendOnlyCollection<>(new IntegerListDataType(), new 
OffHeapMemory(1 << 10));
     var random = new Random(0);
     var positions = new ArrayList<Long>();
     var values = new ArrayList<ArrayList<Integer>>();
@@ -47,11 +47,11 @@ class AppendStoreTest {
       for (int j = 0; j < size; j++) {
         value.add(random.nextInt(1 << 20));
       }
-      positions.add(store.add(value));
+      positions.add(store.append(value));
       values.add(value);
     }
     for (int i = 0; i < positions.size(); i++) {
-      var value = store.get(positions.get(i));
+      var value = store.read(positions.get(i));
       assertEquals(values.get(i), value);
     }
   }
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/LongMapTest.java 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/LongMapTest.java
index a4843335..13657a4b 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/LongMapTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/LongMapTest.java
@@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.stream.Stream;
 import org.apache.baremaps.collection.memory.OffHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.store.MemoryAlignedDataStore;
 import org.apache.baremaps.collection.type.LongDataType;
 import org.apache.baremaps.collection.type.PairDataType;
@@ -40,14 +40,14 @@ class LongMapTest {
   static Stream<Arguments> mapProvider() {
     return Stream
         .of(Arguments.of(
-            new LongOpenHashMap<>(new AppendOnlyStore<>(new LongDataType(), 
new OffHeapMemory()))),
+            new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
LongDataType(), new OffHeapMemory()))),
             Arguments.of(new SortedLongFixedSizeDataMap<>(
                 new MemoryAlignedDataStore<>(new LongDataType(), new 
OffHeapMemory()))),
             Arguments.of(new SortedLongVariableSizeDataMap<>(
                 new MemoryAlignedDataStore<>(
                     new PairDataType<>(new LongDataType(), new LongDataType()),
                     new OffHeapMemory()),
-                new AppendOnlyStore<>(new LongDataType(), new 
OffHeapMemory()))),
+                new AppendOnlyCollection<>(new LongDataType(), new 
OffHeapMemory()))),
             Arguments.of(new SparseLongFixedSizeDataMap<>(
                 new MemoryAlignedDataStore<>(new LongDataType(), new 
OffHeapMemory()))),
             Arguments.of(
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/sort/ExternalMergeSortTest.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/sort/ExternalMergeSortTest.java
index fe18bb1e..d8e2ab27 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/collection/sort/ExternalMergeSortTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/collection/sort/ExternalMergeSortTest.java
@@ -22,7 +22,7 @@ import java.util.List;
 import java.util.Random;
 import java.util.function.Supplier;
 import org.apache.baremaps.collection.memory.OnHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.store.DataStore;
 import org.apache.baremaps.collection.store.IndexedDataStore;
 import org.apache.baremaps.collection.store.MemoryAlignedDataStore;
@@ -45,7 +45,7 @@ class ExternalMergeSortTest {
   void before() {
     supplier = () -> new IndexedDataStore<>(
         new MemoryAlignedDataStore<>(new LongDataType(), new OnHeapMemory()),
-        new AppendOnlyStore<>(new StringDataType(), new OnHeapMemory()));
+        new AppendOnlyCollection<>(new StringDataType(), new OnHeapMemory()));
     input = supplier.get();
     output = supplier.get();
     for (var string : strings) {
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateDataTest.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateDataTest.java
index b4cb85a0..1e258594 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateDataTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateDataTest.java
@@ -22,7 +22,7 @@ import java.util.List;
 import org.apache.baremaps.collection.LongMap;
 import org.apache.baremaps.collection.LongOpenHashMap;
 import org.apache.baremaps.collection.memory.OnHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.type.CoordinateDataType;
 import org.apache.baremaps.collection.type.LongListDataType;
 import org.apache.baremaps.database.ImportService;
@@ -52,9 +52,9 @@ class ImportUpdateDataTest extends DatabaseContainerTest {
     PostgresRelationRepository relationRepository = new 
PostgresRelationRepository(dataSource());
 
     LongMap<Coordinate> coordinateMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new CoordinateDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
CoordinateDataType(), new OnHeapMemory()));
     LongMap<List<Long>> referenceMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new LongListDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
LongListDataType(), new OnHeapMemory()));
 
     // Import data
     new ImportService(SIMPLE_DATA_OSM_PBF, coordinateMap, referenceMap, 
headerRepository,
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateLiechtensteinTest.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateLiechtensteinTest.java
index 5c7e6f63..eac3e995 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateLiechtensteinTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateLiechtensteinTest.java
@@ -21,7 +21,7 @@ import java.util.List;
 import org.apache.baremaps.collection.LongMap;
 import org.apache.baremaps.collection.LongOpenHashMap;
 import org.apache.baremaps.collection.memory.OnHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.type.CoordinateDataType;
 import org.apache.baremaps.collection.type.LongListDataType;
 import org.apache.baremaps.database.DiffService;
@@ -49,9 +49,9 @@ class ImportUpdateLiechtensteinTest extends 
DatabaseContainerTest {
     PostgresRelationRepository relationRepository = new 
PostgresRelationRepository(dataSource());
 
     LongMap<Coordinate> coordinateMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new CoordinateDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
CoordinateDataType(), new OnHeapMemory()));
     LongMap<List<Long>> referenceMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new LongListDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
LongListDataType(), new OnHeapMemory()));
 
     // Import data
     new ImportService(LIECHTENSTEIN_OSM_PBF, coordinateMap, referenceMap, 
headerRepository,
diff --git 
a/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateMonacoTest.java
 
b/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateMonacoTest.java
index e2879b08..654ac139 100644
--- 
a/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateMonacoTest.java
+++ 
b/baremaps-core/src/test/java/org/apache/baremaps/database/database/ImportUpdateMonacoTest.java
@@ -19,7 +19,7 @@ import java.util.List;
 import org.apache.baremaps.collection.LongMap;
 import org.apache.baremaps.collection.LongOpenHashMap;
 import org.apache.baremaps.collection.memory.OnHeapMemory;
-import org.apache.baremaps.collection.store.AppendOnlyStore;
+import org.apache.baremaps.collection.store.AppendOnlyCollection;
 import org.apache.baremaps.collection.type.CoordinateDataType;
 import org.apache.baremaps.collection.type.LongListDataType;
 import org.apache.baremaps.database.DiffService;
@@ -48,9 +48,9 @@ class ImportUpdateMonacoTest extends DatabaseContainerTest {
     PostgresRelationRepository relationRepository = new 
PostgresRelationRepository(dataSource());
 
     LongMap<Coordinate> coordinateMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new CoordinateDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
CoordinateDataType(), new OnHeapMemory()));
     LongMap<List<Long>> referenceMap =
-        new LongOpenHashMap<>(new AppendOnlyStore<>(new LongListDataType(), 
new OnHeapMemory()));
+        new LongOpenHashMap<>(new AppendOnlyCollection<>(new 
LongListDataType(), new OnHeapMemory()));
 
     // Import data
     new ImportService(TestFiles.resolve("monaco/monaco-210801.osm.pbf"), 
coordinateMap,

Reply via email to