Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.index.knn.codec;

import org.apache.lucene.util.BytesRef;

/**
* Interface abstracts the vector serializer object that is responsible for serialization and de-serialization of k-NN vector
*/
public interface KNNVectorSerializer {
/**
* Serializes array of floats to array of bytes
* @param input array that will be converted
* @return array of bytes that contains serialized input array
*/
byte[] floatToByteArray(float[] input);

/**
* Deserializes all bytes from the stream to array of floats
*
* @param bytesRef bytes that will be used for deserialization to array of floats
* @return array of floats deserialized from the stream
*/
float[] byteToFloatArray(BytesRef bytesRef);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/** Common interfaces for knn codecs to extend. */
package org.opensearch.index.knn.codec;
Loading