File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -200,7 +200,10 @@ use model::{
200
200
} ,
201
201
ExternalPackagesModel ,
202
202
} ,
203
- file_storage:: FileStorageId ,
203
+ file_storage:: {
204
+ types:: FileStorageEntry ,
205
+ FileStorageId ,
206
+ } ,
204
207
modules:: {
205
208
module_versions:: {
206
209
AnalyzedModule ,
@@ -2193,6 +2196,17 @@ impl<RT: Runtime> Application<RT> {
2193
2196
Ok ( storage_id)
2194
2197
}
2195
2198
2199
+ pub async fn store_file_entry (
2200
+ & self ,
2201
+ entry : FileStorageEntry ,
2202
+ ) -> anyhow:: Result < DeveloperDocumentId > {
2203
+ let storage_id = self
2204
+ . file_storage
2205
+ . store_entry ( entry, & self . usage_tracking )
2206
+ . await ?;
2207
+ Ok ( storage_id)
2208
+ }
2209
+
2196
2210
pub async fn get_file ( & self , storage_id : FileStorageId ) -> anyhow:: Result < FileStream > {
2197
2211
let mut file_storage_tx = self . begin ( Identity :: system ( ) ) . await ?;
2198
2212
@@ -2576,6 +2590,10 @@ impl<RT: Runtime> Application<RT> {
2576
2590
. map ( |( ts, t, _) | ( ts, t) )
2577
2591
}
2578
2592
2593
+ pub fn files_storage ( & self ) -> Arc < dyn Storage > {
2594
+ self . files_storage . clone ( )
2595
+ }
2596
+
2579
2597
pub async fn shutdown ( & self ) -> anyhow:: Result < ( ) > {
2580
2598
self . log_sender . shutdown ( ) ?;
2581
2599
self . table_summary_worker . shutdown ( ) . await ?;
Original file line number Diff line number Diff line change @@ -370,10 +370,19 @@ impl<RT: Runtime> FileStorage<RT> {
370
370
. transactional_file_storage
371
371
. upload_file ( content_length, content_type, file, expected_sha256)
372
372
. await ?;
373
- let size = entry. size ;
373
+ self . store_entry ( entry, usage_tracker) . await
374
+ }
374
375
376
+ /// Record the existence of a file that has already been uploaded to the
377
+ /// underlying storage implementation.
378
+ pub async fn store_entry (
379
+ & self ,
380
+ entry : FileStorageEntry ,
381
+ usage_tracker : & dyn StorageUsageTracker ,
382
+ ) -> anyhow:: Result < DeveloperDocumentId > {
375
383
// Start/Complete transaction after the slow upload process
376
384
// to avoid OCC risk.
385
+ let size = entry. size ;
377
386
let mut tx = self . database . begin ( Identity :: system ( ) ) . await ?;
378
387
let virtual_id = self
379
388
. transactional_file_storage
You can’t perform that action at this time.
0 commit comments