Skip to main content

PhotoRepo

Struct PhotoRepo 

Source
pub struct PhotoRepo<'a> { /* private fields */ }
Expand description

Photo repository for database operations

Implementations§

Source§

impl<'a> PhotoRepo<'a>

Source

pub fn new(conn: &'a Connection) -> Self

Source

pub fn insert_batch_stub(&self, photos: &[PhotoInsert]) -> SqliteResult<usize>

Batch insert stub rows (streaming scanner Phase 1B).

Uses INSERT OR IGNORE so an idempotent re-scan never blows away metadata that Phase 2+ already filled in. Only sets the columns known at walk time; everything else (EXIF, thumbnail, geocoding) is updated later by the pipeline workers.

Source

pub fn insert_batch(&self, photos: &[PhotoInsert]) -> SqliteResult<usize>

Batch insert photos within a transaction

Source

pub fn count(&self) -> SqliteResult<i64>

Get total photo count

Source

pub fn count_timeline_visible(&self, show_stacks: bool) -> SqliteResult<i64>

Source

pub fn count_pending_metadata(&self) -> SqliteResult<i64>

Photos awaiting EXIF / geocoding extraction (Phase 2 of the streaming scanner). Drives the “Resume reading metadata” banner.

Source

pub fn count_pending_thumbnails(&self) -> SqliteResult<i64>

Photos awaiting thumbnail generation (Phase 3).

Source

pub fn get_all_by_date( &self, limit: i64, offset: i64, ) -> SqliteResult<Vec<Photo>>

Get all photos ordered by date

Source

pub fn get_by_ids(&self, photo_ids: &[i64]) -> SqliteResult<Vec<Photo>>

Get photos by IDs ordered by date (descending).

Source

pub fn get_by_id(&self, id: i64) -> SqliteResult<Option<Photo>>

Get a single photo by ID.

Source

pub fn set_favorite(&self, id: i64, is_favorite: bool) -> SqliteResult<usize>

Source

pub fn count_favorites(&self) -> SqliteResult<i64>

Source

pub fn favorites_album_summary( &self, ) -> SqliteResult<Option<FavoriteAlbumSummary>>

Source§

impl<'a> PhotoRepo<'a>

Source

pub fn list_after( &self, cursor: Option<(Option<DateTime<Utc>>, i64)>, limit: i64, include_trashed: bool, show_stacks: bool, ) -> SqliteResult<Vec<PhotoLite>>

Cursor-paginated timeline list. Cursor key is (date_taken, id) descending. NULL date_taken sorts last via SQLite’s IS NULL. limit is clamped by the caller; this just trusts it.

Source

pub fn list_at_offset( &self, offset: i64, limit: i64, include_trashed: bool, show_stacks: bool, ) -> SqliteResult<Vec<PhotoLite>>

Offset-addressed timeline window. Used only for fast jumps into very large timelines; cursor paging remains the normal path.

Source

pub fn timeline_neighbors( &self, photo_id: i64, show_stacks: bool, ) -> SqliteResult<Option<TimelineNeighbors>>

Source

pub fn list_after_by_album( &self, album_id: i64, cursor: Option<(Option<DateTime<Utc>>, i64)>, limit: i64, ) -> SqliteResult<Vec<PhotoLite>>

Cursor-paginated photos in a specific album, ordered by date.

Source

pub fn list_after_favorites( &self, cursor: Option<(Option<DateTime<Utc>>, i64)>, limit: i64, ) -> SqliteResult<Vec<PhotoLite>>

Cursor-paginated favorite photos. This backs the virtual Favorites album without writing synthetic rows to albums.

Source

pub fn list_after_by_person( &self, cluster_id: i64, cursor: Option<(Option<DateTime<Utc>>, i64)>, limit: i64, ) -> SqliteResult<Vec<PhotoLite>>

Cursor-paginated photos featuring a person (face cluster).

Source

pub fn list_after_by_date( &self, start_iso: &str, end_iso: &str, cursor: Option<(Option<DateTime<Utc>>, i64)>, limit: i64, ) -> SqliteResult<Vec<PhotoLite>>

Cursor-paginated photos in a half-open date range: [start, end).

Source

pub fn list_after_by_place( &self, city: Option<&str>, country: Option<&str>, cursor: Option<(Option<DateTime<Utc>>, i64)>, limit: i64, ) -> SqliteResult<Vec<PhotoLite>>

Cursor-paginated photos in a place (city and/or country, both optional).

Source

pub fn list_in_bounds( &self, north: f64, south: f64, east: f64, west: f64, cap: i64, ) -> SqliteResult<Vec<PhotoLite>>

Photos within a lat/lng bounding box that have GPS coordinates. Used by map.pins for server-side aggregation.

Bounds are inclusive on all sides. Returns a hard cap of cap rows.

Auto Trait Implementations§

§

impl<'a> Freeze for PhotoRepo<'a>

§

impl<'a> !RefUnwindSafe for PhotoRepo<'a>

§

impl<'a> !Send for PhotoRepo<'a>

§

impl<'a> !Sync for PhotoRepo<'a>

§

impl<'a> Unpin for PhotoRepo<'a>

§

impl<'a> UnsafeUnpin for PhotoRepo<'a>

§

impl<'a> !UnwindSafe for PhotoRepo<'a>

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
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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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