Skip to content

Commit cab866a

Browse files
authored
Resolve merge conflicts (#62)
1 parent dfd2633 commit cab866a

3 files changed

Lines changed: 0 additions & 62 deletions

File tree

src/core/centroid_crdt.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ use crate::core::centroid::Centroid;
22
use crate::core::vector::Vector;
33
use serde::{Deserialize, Serialize};
44
use std::collections::{HashMap, HashSet};
5-
<<<<<<< Updated upstream
65
use thiserror::Error;
7-
=======
8-
>>>>>>> Stashed changes
96
use uuid::Uuid;
107

118
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -66,15 +63,11 @@ impl CentroidCRDT {
6663
centroid_id
6764
}
6865

69-
<<<<<<< Updated upstream
7066
pub fn update_centroid(
7167
&mut self,
7268
centroid_id: Uuid,
7369
vector: Vector,
7470
) -> Result<(), CentroidCRDTError> {
75-
=======
76-
pub fn update_centroid(&mut self, centroid_id: Uuid, vector: Vector) -> Result<(), String> {
77-
>>>>>>> Stashed changes
7871
if !self.centroids.contains_key(&centroid_id) {
7972
return Err(CentroidCRDTError::NotFound(centroid_id));
8073
}
@@ -91,11 +84,7 @@ impl CentroidCRDT {
9184
Ok(())
9285
}
9386

94-
<<<<<<< Updated upstream
9587
pub fn delete_centroid(&mut self, centroid_id: Uuid) -> Result<(), CentroidCRDTError> {
96-
=======
97-
pub fn delete_centroid(&mut self, centroid_id: Uuid) -> Result<(), String> {
98-
>>>>>>> Stashed changes
9988
if !self.centroids.contains_key(&centroid_id) {
10089
return Err(CentroidCRDTError::NotFound(centroid_id));
10190
}
@@ -177,30 +166,21 @@ impl CentroidCRDT {
177166
self.centroids.values().collect()
178167
}
179168

180-
<<<<<<< Updated upstream
181169
pub fn find_nearest(
182170
&self,
183171
vector: &Vector,
184172
limit: usize,
185173
) -> Result<Vec<(&Centroid, f32)>, CentroidCRDTError> {
186-
=======
187-
pub fn find_nearest(&self, vector: &Vector, limit: usize) -> Vec<(&Centroid, f32)> {
188-
>>>>>>> Stashed changes
189174
let mut distances: Vec<(&Centroid, f32)> = self
190175
.centroids
191176
.values()
192177
.map(|c| (c, c.distance_to(vector)))
193178
.collect();
194-
<<<<<<< Updated upstream
195179
if distances.iter().any(|(_, d)| !d.is_finite()) {
196180
return Err(CentroidCRDTError::InvalidDistance);
197181
}
198182

199183
distances.sort_by(|a, b| a.1.partial_cmp(&b.1).unwrap_or(std::cmp::Ordering::Equal));
200-
=======
201-
202-
distances.sort_by(|a, b| a.1.partial_cmp(&b.1).unwrap());
203-
>>>>>>> Stashed changes
204184
distances.truncate(limit);
205185
Ok(distances)
206186
}
@@ -235,12 +215,8 @@ mod tests {
235215
let centroid_id = crdt.create_centroid(vector1);
236216

237217
let vector2 = Vector::new(vec![4.0, 5.0, 6.0]);
238-
<<<<<<< Updated upstream
239218
let res = crdt.update_centroid(centroid_id, vector2);
240219
assert!(res.is_ok());
241-
=======
242-
crdt.update_centroid(centroid_id, vector2).unwrap();
243-
>>>>>>> Stashed changes
244220

245221
assert_eq!(crdt.operations.len(), 2);
246222

@@ -263,12 +239,8 @@ mod tests {
263239
let vector = Vector::new(vec![1.0, 2.0, 3.0]);
264240
let centroid_id = crdt.create_centroid(vector.clone());
265241

266-
<<<<<<< Updated upstream
267242
let res = crdt.delete_centroid(centroid_id);
268243
assert!(res.is_ok());
269-
=======
270-
crdt.delete_centroid(centroid_id).unwrap();
271-
>>>>>>> Stashed changes
272244

273245
assert_eq!(crdt.centroids.len(), 0);
274246
assert_eq!(crdt.operations.len(), 2);

src/darwin/exploration.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,9 @@ impl ExplorationStrategy {
351351
// Compare based on sum of metrics (higher is better)
352352
let a_score: f32 = a.metrics.values().sum();
353353
let b_score: f32 = b.metrics.values().sum();
354-
<<<<<<< Updated upstream
355354
a_score
356355
.partial_cmp(&b_score)
357356
.unwrap_or(std::cmp::Ordering::Equal)
358-
=======
359-
a_score.partial_cmp(&b_score).unwrap()
360-
>>>>>>> Stashed changes
361357
})
362358
}
363359

@@ -382,11 +378,7 @@ impl ExplorationStrategy {
382378
let entry = ArchiveEntry {
383379
modification,
384380
metrics,
385-
<<<<<<< Updated upstream
386381
features: archive_features,
387-
=======
388-
features: features.clone(),
389-
>>>>>>> Stashed changes
390382
added_at: chrono::Utc::now(),
391383
};
392384

src/sharding/manager.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,11 @@ impl ShardManager {
243243
Ok(())
244244
}
245245

246-
<<<<<<< Updated upstream
247246
pub async fn start_migration(
248247
self: Arc<Self>,
249248
shard_id: Uuid,
250249
target_node: &str,
251250
) -> Result<Uuid> {
252-
=======
253-
pub async fn start_migration(&self, shard_id: Uuid, target_node: &str) -> Result<Uuid> {
254-
>>>>>>> Stashed changes
255251
// Verify the shard exists
256252
let shard = self.get_shard(shard_id).await?;
257253

@@ -470,26 +466,4 @@ impl ShardManager {
470466

471467
Ok(distribution)
472468
}
473-
<<<<<<< Updated upstream
474469
}
475-
=======
476-
}
477-
478-
// Support cloning for the manager to allow sharing between threads
479-
impl Clone for ShardManager {
480-
fn clone(&self) -> Self {
481-
// Note: This creates a new instance with the same node_id and metrics
482-
// but empty collections. The collections are meant to be
483-
// accessed through the original instance's RwLocks.
484-
Self {
485-
metrics: self.metrics.clone(),
486-
node_id: self.node_id.clone(),
487-
shards: RwLock::new(HashMap::new()),
488-
shard_assignments: RwLock::new(HashMap::new()),
489-
migrations: RwLock::new(HashMap::new()),
490-
indices: RwLock::new(HashMap::new()),
491-
shard_loads: RwLock::new(HashMap::new()),
492-
}
493-
}
494-
}
495-
>>>>>>> Stashed changes

0 commit comments

Comments
 (0)