Esempio n. 1
0
        /// <summary>
        /// Requests host to copy a file from another source machine.
        /// </summary>
        public async Task <BoolResult> RequestCopyFileAsync(OperationContext context, ContentHash hash)
        {
            try
            {
                var request = new RequestCopyFileRequest
                {
                    TraceId     = context.TracingContext.Id.ToString(),
                    ContentHash = hash.ToByteString(),
                    HashType    = (int)hash.HashType
                };

                var response = await _client.RequestCopyFileAsync(request, cancellationToken : context.Token);

                return(response.Header.Succeeded
                    ? BoolResult.Success
                    : new BoolResult(response.Header.ErrorMessage));
            }
            catch (RpcException r)
            {
                return(new BoolResult(r));
            }
        }