Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion engine/packages/depot-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ tracing.workspace = true
getrandom = "0.2"
rivet-envoy-protocol.workspace = true
depot-client-types.workspace = true
depot.workspace = true
moka = { version = "0.12", default-features = false, features = ["sync"] }
parking_lot.workspace = true

[dev-dependencies]
async-trait.workspace = true
depot = { workspace = true, features = ["test-faults"] }
futures-util.workspace = true
gas.workspace = true
rivet-config.workspace = true
rivet-pools.workspace = true
rivet-test-deps.workspace = true
scc.workspace = true
depot = { workspace = true, features = ["test-faults"] }
sha2.workspace = true
tempfile.workspace = true
universaldb.workspace = true
Expand Down
30 changes: 30 additions & 0 deletions engine/packages/depot-client/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,36 @@ pub async fn open_database_from_envoy(
Ok(native_db)
}

pub async fn open_database_from_conveyer(
db: Arc<depot::conveyer::Db>,
actor_id: String,
generation: u64,
rt_handle: Handle,
metrics: Option<Arc<dyn SqliteVfsMetrics>>,
) -> Result<NativeDatabaseHandle> {
let vfs_name = vfs_name_for_actor_database(&actor_id, generation);
let vfs = Arc::new(
SqliteVfs::register_with_transport(
&vfs_name,
crate::vfs::SqliteTransport::from_conveyer(db),
actor_id.clone(),
rt_handle,
VfsConfig::default(),
metrics.clone(),
)
.map_err(|e| anyhow!("failed to register sqlite VFS: {e}"))?,
);

let native_db = NativeDatabaseHandle::new_with_metrics(
vfs,
actor_id,
NativeConnectionManagerConfig::from_optimization_flags(*sqlite_optimization_flags()),
metrics,
);
native_db.initialize().await?;
Ok(native_db)
}

impl NativeDatabaseHandle {
pub fn new(
vfs: NativeVfsHandle,
Expand Down
Loading
Loading