pub struct PlaybackReporter {
db_service: Arc<RusqliteService>,
jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>,
user_id: String,
}Expand description
Main playback reporter that handles dual sync (local DB + server)
Fields§
§db_service: Arc<RusqliteService>§jellyfin_client: Arc<Mutex<Option<JellyfinClient>>>§user_id: StringImplementations§
Source§impl PlaybackReporter
impl PlaybackReporter
Sourcepub fn new(
db_service: Arc<RusqliteService>,
jellyfin_client: Arc<TokioMutex<Option<JellyfinClient>>>,
user_id: String,
) -> Self
pub fn new( db_service: Arc<RusqliteService>, jellyfin_client: Arc<TokioMutex<Option<JellyfinClient>>>, user_id: String, ) -> Self
Creates a new PlaybackReporter
Sourcepub async fn report(
&self,
operation: PlaybackOperation,
is_online: bool,
) -> Result<(), String>
pub async fn report( &self, operation: PlaybackOperation, is_online: bool, ) -> Result<(), String>
Reports a playback operation (dual sync: local DB + server)
Always updates local DB first, then attempts server sync if online. If server sync fails, operation is queued for retry.
Sourceasync fn update_local_db(
&self,
operation: &PlaybackOperation,
) -> Result<(), String>
async fn update_local_db( &self, operation: &PlaybackOperation, ) -> Result<(), String>
Updates local database with playback info
Sourceasync fn sync_to_server(
&self,
operation: &PlaybackOperation,
) -> Result<(), String>
async fn sync_to_server( &self, operation: &PlaybackOperation, ) -> Result<(), String>
Syncs to Jellyfin server
Sourceasync fn queue_for_sync(
&self,
operation: &PlaybackOperation,
) -> Result<(), String>
async fn queue_for_sync( &self, operation: &PlaybackOperation, ) -> Result<(), String>
Queues operation for later sync
Sourceasync fn mark_synced(&self, item_id: &str) -> Result<(), String>
async fn mark_synced(&self, item_id: &str) -> Result<(), String>
Marks an item as synced in the local database
Sourcefn get_item_id(&self, operation: &PlaybackOperation) -> Option<String>
fn get_item_id(&self, operation: &PlaybackOperation) -> Option<String>
Extracts item_id from operation
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PlaybackReporter
impl !RefUnwindSafe for PlaybackReporter
impl Send for PlaybackReporter
impl Sync for PlaybackReporter
impl Unpin for PlaybackReporter
impl UnsafeUnpin for PlaybackReporter
impl !UnwindSafe for PlaybackReporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more