Skip to content

Commit

Permalink
Introduce VolumeFingerprint and related types, improving type safety …
Browse files Browse the repository at this point in the history
…and consistency across the module
  • Loading branch information
jamiepine committed Nov 4, 2024
1 parent a50db68 commit 63757a3
Show file tree
Hide file tree
Showing 10 changed files with 460 additions and 271 deletions.
16 changes: 13 additions & 3 deletions core/src/api/volumes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{utils::library, Ctx, R};
use crate::library::Library;
use crate::volume::VolumeEvent;
use crate::volume::{VolumeEvent, VolumeFingerprint};
use rspc::alpha::AlphaRouter;
use serde::Deserialize;
use specta::Type;
Expand All @@ -10,7 +10,7 @@ use tokio_stream::StreamExt;

#[derive(Type, Deserialize)]
pub struct TrackVolumeInput {
pub volume_id: Vec<u8>,
pub volume_id: VolumeFingerprint,
}

pub(crate) fn mount() -> AlphaRouter<Ctx> {
Expand Down Expand Up @@ -56,12 +56,22 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
.map_err(Into::into)
}),
)
// .procedure(
// "listByDevice",
// R.with2(library())
// .query(|(node, library), _: ()| async move {
// node.volumes
// .list_by_device(library)
// .await
// .map_err(Into::into)
// }),
// )
.procedure(
"unmount",
R.with2(library())
.mutation(|(node, _), fingerprint: Vec<u8>| async move {
node.volumes
.unmount_volume(fingerprint)
.unmount_volume(VolumeFingerprint(fingerprint).into())
.await
.map_err(Into::into)
}),
Expand Down
Loading

0 comments on commit 63757a3

Please sign in to comment.