the-algorithm/ann/src/main/scala/com/twitter/ann/common/Serialization.scala
twitter-team ef4c5eb65e Twitter Recommendation Algorithm
Please note we have force-pushed a new initial commit in order to remove some publicly-available Twitter user information. Note that this process may be required in the future.
2023-03-31 17:36:31 -05:00

29 lines
682 B
Scala

package com.twitter.ann.common
import com.twitter.search.common.file.AbstractFile
import org.apache.beam.sdk.io.fs.ResourceId
/**
* Interface for writing an Appendable to a directory.
*/
trait Serialization {
def toDirectory(
serializationDirectory: AbstractFile
): Unit
def toDirectory(
serializationDirectory: ResourceId
): Unit
}
/**
* Interface for reading a Queryable from a directory
* @tparam T the id of the embeddings
* @tparam Q type of the Queryable that is deserialized.
*/
trait QueryableDeserialization[T, P <: RuntimeParams, D <: Distance[D], Q <: Queryable[T, P, D]] {
def fromDirectory(
serializationDirectory: AbstractFile
): Q
}