mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-01 08:48:46 +02:00
ef4c5eb65e
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.
29 lines
682 B
Scala
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
|
|
}
|