33 *
44 * This source file is part of the FoundationDB open source project
55 *
6- * Copyright 2015-2023 Apple Inc. and the FoundationDB project authors
6+ * Copyright 2015-2025 Apple Inc. and the FoundationDB project authors
77 *
88 * Licensed under the Apache License, Version 2.0 (the "License");
99 * you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ abstract class AbstractStorageAdapter<N extends NodeReference> implements Storag
4848 private static final Logger logger = LoggerFactory .getLogger (AbstractStorageAdapter .class );
4949
5050 @ Nonnull
51- private final HNSW . Config config ;
51+ private final Config config ;
5252 @ Nonnull
5353 private final NodeFactory <N > nodeFactory ;
5454 @ Nonnull
@@ -73,7 +73,7 @@ abstract class AbstractStorageAdapter<N extends NodeReference> implements Storag
7373 * @param onWriteListener the listener to be called on write operations
7474 * @param onReadListener the listener to be called on read operations
7575 */
76- protected AbstractStorageAdapter (@ Nonnull final HNSW . Config config , @ Nonnull final NodeFactory <N > nodeFactory ,
76+ protected AbstractStorageAdapter (@ Nonnull final Config config , @ Nonnull final NodeFactory <N > nodeFactory ,
7777 @ Nonnull final Subspace subspace ,
7878 @ Nonnull final OnWriteListener onWriteListener ,
7979 @ Nonnull final OnReadListener onReadListener ) {
@@ -88,11 +88,11 @@ protected AbstractStorageAdapter(@Nonnull final HNSW.Config config, @Nonnull fin
8888 /**
8989 * Returns the configuration used to build and search this HNSW graph.
9090 *
91- * @return the current {@link HNSW. Config} object, never {@code null}.
91+ * @return the current {@link Config} object, never {@code null}.
9292 */
9393 @ Override
9494 @ Nonnull
95- public HNSW . Config getConfig () {
95+ public Config getConfig () {
9696 return config ;
9797 }
9898
@@ -195,14 +195,14 @@ public OnReadListener getOnReadListener() {
195195 * @param layer the layer of the tree from which to fetch the node
196196 * @param primaryKey the non-null primary key that identifies the node to fetch
197197 *
198- * @return a {@link CompletableFuture} that will complete with the fetched {@link Node }
198+ * @return a {@link CompletableFuture} that will complete with the fetched {@link AbstractNode }
199199 * once it has been read from storage and validated
200200 */
201201 @ Nonnull
202202 @ Override
203- public CompletableFuture <Node <N >> fetchNode (@ Nonnull final ReadTransaction readTransaction ,
204- @ Nonnull final AffineOperator storageTransform ,
205- int layer , @ Nonnull Tuple primaryKey ) {
203+ public CompletableFuture <AbstractNode <N >> fetchNode (@ Nonnull final ReadTransaction readTransaction ,
204+ @ Nonnull final AffineOperator storageTransform ,
205+ int layer , @ Nonnull Tuple primaryKey ) {
206206 return fetchNodeInternal (readTransaction , storageTransform , layer , primaryKey ).thenApply (this ::checkNode );
207207
208208 }
@@ -220,13 +220,13 @@ public CompletableFuture<Node<N>> fetchNode(@Nonnull final ReadTransaction readT
220220 * @param layer the layer index from which to fetch the node
221221 * @param primaryKey the primary key that uniquely identifies the node to be fetched; must not be {@code null}
222222 *
223- * @return a {@link CompletableFuture} that will be completed with the fetched {@link Node }.
223+ * @return a {@link CompletableFuture} that will be completed with the fetched {@link AbstractNode }.
224224 * The future will complete with {@code null} if no node is found for the given key and layer.
225225 */
226226 @ Nonnull
227- protected abstract CompletableFuture <Node <N >> fetchNodeInternal (@ Nonnull ReadTransaction readTransaction ,
228- @ Nonnull AffineOperator storageTransform ,
229- int layer , @ Nonnull Tuple primaryKey );
227+ protected abstract CompletableFuture <AbstractNode <N >> fetchNodeInternal (@ Nonnull ReadTransaction readTransaction ,
228+ @ Nonnull AffineOperator storageTransform ,
229+ int layer , @ Nonnull Tuple primaryKey );
230230
231231 /**
232232 * Method to perform basic invariant check(s) on a newly-fetched node.
@@ -237,7 +237,7 @@ protected abstract CompletableFuture<Node<N>> fetchNodeInternal(@Nonnull ReadTra
237237 * @return the node that was passed in
238238 */
239239 @ Nullable
240- private Node <N > checkNode (@ Nullable final Node < N > node ) {
240+ private < T extends Node <N >> T checkNode (@ Nullable final T node ) {
241241 return node ;
242242 }
243243
@@ -259,7 +259,7 @@ private Node<N> checkNode(@Nullable final Node<N> node) {
259259 */
260260 @ Override
261261 public void writeNode (@ Nonnull final Transaction transaction , @ Nonnull final Quantizer quantizer ,
262- @ Nonnull final Node <N > node , final int layer ,
262+ @ Nonnull final AbstractNode <N > node , final int layer ,
263263 @ Nonnull final NeighborsChangeSet <N > changeSet ) {
264264 writeNodeInternal (transaction , quantizer , node , layer , changeSet );
265265 if (logger .isTraceEnabled ()) {
@@ -283,7 +283,7 @@ public void writeNode(@Nonnull final Transaction transaction, @Nonnull final Qua
283283 * removals of neighbor links
284284 */
285285 protected abstract void writeNodeInternal (@ Nonnull Transaction transaction , @ Nonnull Quantizer quantizer ,
286- @ Nonnull Node <N > node , int layer ,
286+ @ Nonnull AbstractNode <N > node , int layer ,
287287 @ Nonnull NeighborsChangeSet <N > changeSet );
288288
289289}
0 commit comments