pub struct Db { /* private fields */ }Expand description
Thread-safe SQLite connection pool (single connection with Mutex for simplicity).
Implementations§
Source§impl Db
impl Db
pub fn open(path: &str) -> Result<Self>
pub fn create_user(&self, username: &str, password_hash: &str) -> Result<i64>
pub fn get_user_by_username( &self, username: &str, ) -> Result<Option<(i64, String)>>
pub fn insert_token( &self, token: &str, user_id: Option<i64>, name: Option<&str>, expires_at: Option<&str>, ) -> Result<()>
Sourcepub fn validate_token(
&self,
token: &str,
) -> Result<Option<(Option<i64>, Option<String>)>>
pub fn validate_token( &self, token: &str, ) -> Result<Option<(Option<i64>, Option<String>)>>
Returns (user_id, name) if token is valid (not revoked, not expired).
pub fn layer_exists( &self, namespace: &str, name: &str, version: &str, ) -> Result<bool>
pub fn insert_layer( &self, namespace: &str, name: &str, version: &str, description: Option<&str>, tags: &[String], pushed_by: Option<i64>, ) -> Result<()>
pub fn list_layers(&self) -> Result<Vec<LayerSummary>>
pub fn search_layers(&self, query: &str) -> Result<Vec<LayerSummary>>
pub fn get_versions(&self, namespace: &str, name: &str) -> Result<Vec<String>>
pub fn get_stats(&self) -> Result<RegistryStats>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Db
impl RefUnwindSafe for Db
impl Send for Db
impl Sync for Db
impl Unpin for Db
impl UnsafeUnpin for Db
impl UnwindSafe for Db
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