mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 02:29:55 +02:00
fix(storage): reclaim transfer cache and track received files
This commit is contained in:
@@ -143,6 +143,25 @@ final class CoreRepository: ObservableObject, CoreGateway {
|
||||
}
|
||||
}
|
||||
|
||||
func storageUsage() async -> Result<CoreStorageUsageModel, Error> {
|
||||
await runCore {
|
||||
let usage = try self.requireCore().storageUsage()
|
||||
return CoreStorageUsageModel(
|
||||
blobStoreBytes: usage.blobStoreBytes,
|
||||
appDataBytes: usage.databaseBytes + usage.logsBytes + usage.previewsBytes + usage.otherCoreBytes
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func receivedArtifacts() async -> Result<[ReceivedArtifactModel], Error> {
|
||||
await runCore {
|
||||
try self.requireCore().listReceivedArtifacts().compactMap { artifact in
|
||||
guard artifact.locatorKind == .filesystemPath else { return nil }
|
||||
return ReceivedArtifactModel(locator: artifact.locator, logicalSize: artifact.logicalSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func receiverRequests(transferId: UInt64) async -> Result<[ReceiverRequestModel], Error> {
|
||||
await runCore {
|
||||
try self.requireCore().listReceiverRequests(transferId: transferId).map { $0.toModel() }
|
||||
|
||||
Reference in New Issue
Block a user