protected override async Task <Result <string> > UploadFileCoreAsync(OperationContext context, AbsolutePath file, string blobName, bool garbageCollect = false) { // Add the file to CAS and register with global content location store. var putResult = await PutAndRegisterFileAsync(context, file, hash : null); if (putResult.Succeeded && _configuration.ProactiveCopyCheckpointFiles) { var hashWithSize = new ContentHashWithSize(putResult.ContentHash, putResult.ContentSize); var pushResult = await PushCheckpointFileAsync(context, hashWithSize) .FireAndForgetOrInlineAsync(context, _configuration.InlineCheckpointProactiveCopies); if (!pushResult.Succeeded) { return(new Result <string>(pushResult)); } } string fallbackStorageId = await _fallbackStorage.UploadFileAsync( context, file, name : $"{blobName}.{putResult.ContentHash.Serialize(delimiter: '.')}", garbageCollect).ThrowIfFailureAsync(); return(CreateCompositeStorageId(putResult.ContentHash, fallbackStorageId)); }
private async Task CreateFullCheckpointAsync(OperationContext context, EventSequencePoint sequencePoint) { // Zipping the checkpoint var targetZipFile = _checkpointStagingDirectory + ".zip"; File.Delete(targetZipFile); ZipFile.CreateFromDirectory(_checkpointStagingDirectory.ToString(), targetZipFile); // Track checkpoint size var fileInfo = new System.IO.FileInfo(targetZipFile); _tracer.TrackMetric(context, CheckpointSizeMetricName, fileInfo.Length); var checkpointBlobName = $"checkpoints/{sequencePoint.SequenceNumber}.{Guid.NewGuid()}.zip"; var checkpointId = await _storage.UploadFileAsync(context, new AbsolutePath(targetZipFile), checkpointBlobName, garbageCollect : true).ThrowIfFailureAsync(); // Uploading the checkpoint await _checkpointRegistry.RegisterCheckpointAsync(context, checkpointId, sequencePoint).ThrowIfFailure(); }
protected override async Task <Result <string> > UploadFileCoreAsync(OperationContext context, AbsolutePath file, string blobName, bool garbageCollect = false) { // Add the file to CAS and register with global content location store. var putResult = await PutFileAsync(context, file, hash : null, isUpload : true); string fallbackStorageId = await _fallbackStorage.UploadFileAsync( context, file, name : $"{blobName}.{putResult.ContentHash.Serialize(delimiter: '.')}", garbageCollect).ThrowIfFailureAsync(); return(CreateCompositeStorageId(putResult.ContentHash, fallbackStorageId)); }