]> git.ipfire.org Git - thirdparty/zstd.git/commit
[contrib] Support seek table-only API 2113/head
authorMark Dittmer <markdittmer@google.com>
Thu, 7 May 2020 13:31:43 +0000 (09:31 -0400)
committerMark Dittmer <markdittmer@google.com>
Thu, 7 May 2020 13:31:43 +0000 (09:31 -0400)
commit9b8f337357aaf1cb3dde8ed608bac20cc23d2fc1
treefe54c10fa1c5f982e17fd518ea123f36ac191abf
parent5717bd39ee1bd5d2855023652336deeb722a57d5
[contrib] Support seek table-only API

Memory constrained use cases that manage multiple archives benefit from
retaining multiple archive seek tables without retaining a ZSTD_seekable
instance for each.

* New opaque type for seek table: ZSTD_seekTable.
* ZSTD_seekable_copySeekTable() supports copying seek table out of a
  ZSTD_seekable.
* ZSTD_seekTable_[eachSeekTableOp]() defines seek table API that mirrors
  existing seek table operations.
* Existing ZSTD_seekable_[eachSeekTableOp]() retained; they delegate to
  ZSTD_seekTable the variant.

These changes allow the above-mentioned use cases to initialize a
ZSTD_seekable, extract its ZSTD_seekTable, then throw the ZSTD_seekable
away to save memory. Standard ZSTD operations can then be used to
decompress frames based on seek table offsets.

The copy and delegate patterns are intended to minimize impact on
existing code and clients. Using copy instead of move for the infrequent
operation extracting a seek table ensures that the extraction does not
render the ZSTD_seekable useless. Delegating to *new* seek
table-oriented APIs ensures that this is not a breaking change for
existing clients while supporting all meaningful operations that depend
only on seek table data.
contrib/seekable_format/zstd_seekable.h
contrib/seekable_format/zstdseek_decompress.c