public Result OperateRange(out QueryRangeInfo rangeInfo, int operationId, long offset, long size) { UnsafeHelpers.SkipParamInit(out rangeInfo); rangeInfo.Clear(); if (operationId == (int)OperationId.InvalidateCache) { Result rc = BaseFile.OperateRange(Span <byte> .Empty, OperationId.InvalidateCache, offset, size, ReadOnlySpan <byte> .Empty); if (rc.IsFailure()) { return(rc); } } else if (operationId == (int)OperationId.QueryRange) { Unsafe.SkipInit(out QueryRangeInfo info); Result rc = BaseFile.OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryRange, offset, size, ReadOnlySpan <byte> .Empty); if (rc.IsFailure()) { return(rc); } rangeInfo.Merge(in info); } return(Result.Success); }
protected override Result DoOperateRange(Span <byte> outBuffer, OperationId operationId, long offset, long size, ReadOnlySpan <byte> inBuffer) { switch (operationId) { case OperationId.InvalidateCache: return(BaseStorage.Target.OperateRange(out _, (int)OperationId.InvalidateCache, offset, size)); case OperationId.QueryRange: if (outBuffer.Length != Unsafe.SizeOf <QueryRangeInfo>()) { return(ResultFs.InvalidSize.Log()); } ref QueryRangeInfo info = ref SpanHelpers.AsStruct <QueryRangeInfo>(outBuffer); return(BaseStorage.Target.OperateRange(out info, (int)OperationId.QueryRange, offset, size));