Skip to content

Commit

Permalink
File backend stub
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrippling committed Feb 22, 2024
1 parent 55357da commit ba33e49
Showing 1 changed file with 100 additions and 1 deletion.
101 changes: 100 additions & 1 deletion src/backend/backend_file.rs
Original file line number Diff line number Diff line change
@@ -1 +1,100 @@
//todo
use std::future::Future;

use log::{error, info};

use crate::backend::FindError;

use crate::device::{DeviceAndSub, DeviceUpdate};
use crate::episode::{Episode, EpisodeRaw};
use crate::podsync::{QueryEpisodes, Url};
use crate::subscription::SubscriptionChangesFromClient;
use crate::user::User;
use crate::Timestamp;

type Result<T> = std::result::Result<T, ()>;

pub struct Backend;

pub async fn init() {
}

impl Backend {
pub async fn new() -> Self {
Self
}
}

impl Backend {
pub async fn find_user(&self, username: &str) -> std::result::Result<User, FindError> {
todo!()
}

/// session_id: set to None to logout / make NULL
pub async fn update_user(&self, username: &str, session_id: Option<&str>) -> bool {
todo!()
}

pub async fn users_with_session(&self, session_id: &str) -> Result<Vec<User>> {
todo!()
}
}

impl Backend {
pub async fn devices_for_user(&self, username: &str) -> Result<Vec<DeviceAndSub>> {
todo!()
}

pub async fn update_device(
&self,
username: &str,
device_id: &str,
update: DeviceUpdate,
) -> Result<()> {
todo!()
}
}

impl Backend {
pub async fn subscriptions(
&self,
username: &str,
device_id: &str,
since: Timestamp,
) -> Result<Vec<Url>> {
todo!()
}

pub async fn update_subscriptions(
&self,
username: &str,
device_id: &str,
changes: &SubscriptionChangesFromClient,
now: Timestamp,
) -> Result<()> {
todo!()
}
}

impl Backend {
pub async fn episodes(&self, username: &str, query: &QueryEpisodes) -> Result<Vec<EpisodeRaw>> {
todo!()
}

pub async fn update_episodes(
&self,
username: &str,
now: Timestamp,
changes: Vec<Episode>,
) -> Result<()> {
todo!()
}
}

#[cfg(test)]
pub mod test {
use sqlx::{migrate::MigrateDatabase, Pool, Sqlite, SqlitePool};

pub async fn create_db() -> Pool<Sqlite> {
todo!()
}
}

0 comments on commit ba33e49

Please sign in to comment.