Slide 11
Slide 11 text
列挙型とパターンマッチ
● RustではEnumでさまざまな型のデータを持てる
● 例: インデックスへのUpsertとDelete
○ それぞれ異なる型のデータを統一的に処理
pub enum PointOperations {
/// Insert or update points
UpsertPoints(PointInsertOperations),
/// Delete point if exists
DeletePoints { ids: Vec },
}
pub(crate) fn process_point_operation(...) -> CollectionResult {
match point_operation {
PointOperations::DeletePoints { ids, .. } => delete_points(&segments.read(), op_num, &ids),
PointOperations::UpsertPoints(operation) => {
let (ids, vectors, payloads) = match operation {
...
コードの引用: https://github.com/qdrant/qdrant/blob/bf3d8c25753188b4ca5e69a13c7f26e3c383f05b/lib/collection/src/collection_manager/segments_updater.rs#L234-L265