Skip to content

Commit

Permalink
Add docstrings to model structs (#23418)
Browse files Browse the repository at this point in the history
These aren't quite finished yet, but I left something for now.

GitOrigin-RevId: eeaaae14de3f47bda4f64eba90ab83efa6e740ec
  • Loading branch information
sujayakar authored and Convex, Inc. committed Mar 13, 2024
1 parent a27e8d6 commit e8211da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/database/src/bootstrap_model/import_facing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ use crate::{
Transaction,
};

/// `ImportFacingModel` is similar to `UserFacingModel` but with a few
/// differences for insertions:
/// - the table for insertion is chosen by table id, not table name or number.
/// - we allow the insertion to choose its document ID.
/// - nonexistent tables won't be created implicitly.
/// - the _creationTime may be user-specified.
/// - only admin/system auth is allowed.
pub struct ImportFacingModel<'a, RT: Runtime> {
tx: &'a mut Transaction<RT>,
}
Expand All @@ -39,12 +46,6 @@ impl<'a, RT: Runtime> ImportFacingModel<'a, RT> {
}

/// Inserts a new document as part of a snapshot import.
/// This is like `UserFacingModel::insert` with a few differences:
/// - the table for insertion is chosen by table id, not table name or
/// number.
/// - nonexistent tables won't be created implicitly.
/// - the _creationTime may be user-specified.
/// - only admin/system auth is allowed.
#[convex_macro::instrument_future]
pub async fn insert(
&mut self,
Expand Down
7 changes: 7 additions & 0 deletions crates/database/src/bootstrap_model/system_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ use crate::{
Transaction,
};

/// We generally don't let `UserFacingModel` read or write system metadata,
/// so this model is an alternative path for internal use for manipulating
/// these tables.
///
/// Eventually, the goal is to entirely ban system metadata from
/// `UserFacingModel` and strictly require that `SystemMetadataModel` only looks
/// at system metadata.
pub struct SystemMetadataModel<'a, RT: Runtime> {
tx: &'a mut Transaction<RT>,
}
Expand Down

0 comments on commit e8211da

Please sign in to comment.