Skip to main content

MediaStore

Struct MediaStore 

Source
pub struct MediaStore { /* private fields */ }
Expand description

SQLite-backed persistence for media data.

Family membership remains owned by agent-storage; this store only scopes media records by the authoritative family ID supplied by the application.

Implementations§

Source§

impl MediaStore

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, MediaStoreError>

Open or create a media database at path.

Source

pub fn open_in_memory() -> Result<Self, MediaStoreError>

Create an isolated in-memory media database (primarily useful in tests).

Source

pub async fn save_profile( &self, profile: &MediaProfile, ) -> Result<(), MediaStoreError>

Insert or update a media profile without changing its ownership scope.

Source

pub async fn get_or_create_personal_profile( &self, owner_id: UserId, ) -> Result<MediaProfile, MediaStoreError>

Return the user’s personal profile, creating it exactly once when absent.

Source

pub async fn get_personal_profile( &self, owner_id: UserId, profile_id: MediaProfileId, ) -> Result<Option<MediaProfile>, MediaStoreError>

Load a personal profile only when it is owned by the requesting EME user.

Source

pub async fn list_profiles( &self, family_id: FamilyId, ) -> Result<Vec<MediaProfile>, MediaStoreError>

List profiles belonging to one family; no membership data is duplicated here.

Source

pub async fn get_profile( &self, family_id: FamilyId, profile_id: MediaProfileId, ) -> Result<Option<MediaProfile>, MediaStoreError>

Load a profile only within the requested family boundary.

Source

pub async fn delete_profile( &self, family_id: FamilyId, profile_id: MediaProfileId, ) -> Result<(), MediaStoreError>

Remove a profile and its dependent preferences and activity.

Source

pub async fn save_profile_preferences( &self, preferences: &ProfilePreferences, ) -> Result<(), MediaStoreError>

Source

pub async fn get_profile_preferences( &self, profile_id: MediaProfileId, ) -> Result<Option<ProfilePreferences>, MediaStoreError>

Source

pub async fn save_content_restrictions( &self, restrictions: &ContentRestrictions, ) -> Result<(), MediaStoreError>

Source

pub async fn get_content_restrictions( &self, profile_id: MediaProfileId, ) -> Result<Option<ContentRestrictions>, MediaStoreError>

Source

pub async fn save_family_preferences( &self, preferences: &FamilyMediaPreferences, ) -> Result<(), MediaStoreError>

Source

pub async fn get_family_preferences( &self, family_id: FamilyId, ) -> Result<Option<FamilyMediaPreferences>, MediaStoreError>

Source

pub async fn save_media_item( &self, item: &MediaItem, ) -> Result<(), MediaStoreError>

Source

pub async fn get_media_item( &self, id: MediaItemId, ) -> Result<Option<MediaItem>, MediaStoreError>

Source

pub async fn record_watch_event( &self, event: &MediaWatchEvent, ) -> Result<(), MediaStoreError>

Record a viewing event idempotently (same profile, item, timestamp and source).

Source

pub async fn list_watch_history( &self, profile_id: MediaProfileId, ) -> Result<Vec<MediaWatchEvent>, MediaStoreError>

Source

pub async fn save_rating( &self, rating: &MediaRating, ) -> Result<(), MediaStoreError>

Store a profile rating, replacing the previous rating from the same source.

Source

pub async fn list_ratings( &self, profile_id: MediaProfileId, ) -> Result<Vec<MediaRating>, MediaStoreError>

Source

pub async fn save_streaming_offer( &self, offer: &StreamingOffer, ) -> Result<(), MediaStoreError>

Source

pub async fn list_streaming_offers( &self, item_id: MediaItemId, region: &str, ) -> Result<Vec<StreamingOffer>, MediaStoreError>

Persist a short-lived, hashed OAuth state bound to the initiating user and profile.

Consume a pending Trakt state exactly once and reject expired attempts.

Associate a profile with an existing encrypted EME external connection.

Remove a profile’s provider link; token revocation remains the caller’s responsibility.

Source

pub async fn save_watchlist_item( &self, item: &MediaWatchlistItem, ) -> Result<(), MediaStoreError>

Source

pub async fn list_watchlist( &self, profile_id: MediaProfileId, ) -> Result<Vec<MediaWatchlistItem>, MediaStoreError>

Source

pub async fn replace_watchlist( &self, profile_id: MediaProfileId, source: WatchHistorySource, items: &[MediaWatchlistItem], ) -> Result<(), MediaStoreError>

Replace a provider’s watchlist atomically so removals are reflected locally.

Source

pub async fn replace_ratings( &self, profile_id: MediaProfileId, source: WatchHistorySource, ratings: &[MediaRating], ) -> Result<(), MediaStoreError>

Replace all ratings from one provider after a full provider snapshot.

Source

pub async fn get_provider_sync_state( &self, profile_id: MediaProfileId, provider: &str, ) -> Result<Option<ProviderSyncState>, MediaStoreError>

Source

pub async fn save_provider_sync_state( &self, state: &ProviderSyncState, ) -> Result<(), MediaStoreError>

Trait Implementations§

Source§

impl Clone for MediaStore

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more