| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.blobfs.internal; |
| |
| using zx; |
| |
| /// Used to transport the Blobfs CompressionAlgorithm enum. |
| type CompressionAlgorithm = strict enum { |
| UNCOMPRESSED = 1; |
| LZ4 = 2; |
| ZSTD = 3; |
| ZSTD_SEEKABLE = 4; |
| /// For decompressing an entire chunked archive from start to finish. |
| CHUNKED = 5; |
| /// Used for decompressing only part of a chunked archive. |
| CHUNKED_PARTIAL = 6; |
| }; |
| |
| /// A range of bytes. |
| type Range = struct { |
| /// Offset in bytes from the start of the VMO. |
| offset uint64; |
| /// The number of bytes starting at the offset. |
| size uint64; |
| }; |
| |
| /// A request sent to the decompressor. |
| type DecompressRequest = struct { |
| /// The bytes where the decompressed result will be placed. |
| decompressed Range; |
| /// The bytes from the compressed input to extract from. |
| compressed Range; |
| |
| /// Algorithm to use for decompression. |
| algorithm CompressionAlgorithm; |
| }; |
| |
| /// A response from the decompressor after handling a `DecompressRangeRequest`. |
| type DecompressResponse = struct { |
| /// Decompressed size in bytes. |
| size uint64; |
| /// Operation status. |
| status zx.status; |
| |
| /// Padding out to the same length as `DecompressRangeRequest`. Values must be zero. |
| reserved array<int8, 24>; |
| }; |
| |
| @discoverable |
| protocol DecompressorCreator { |
| /// Takes the server end of a fifo for `DecompressRangeRequest` objects to |
| /// handle requests and put `DecopmressRangeResponse` responses on. Data |
| /// for requests is read from `compressed_vmo` and results written to |
| /// `decompressed_vmo`. |
| Create(resource struct { |
| server_end zx.handle:FIFO; |
| compressed_vmo zx.handle:VMO; |
| decompressed_vmo zx.handle:VMO; |
| }) -> (struct { |
| status zx.status; |
| }); |
| }; |