refactor(mt): move terminal frame action policy to Rust
Classify the MT terminal-job flags in Rust while retaining the two private C mutations as narrow callbacks. Descriptor setup, reusable-input reset, and terminal frame publication keep their original order; nonterminal jobs remain untouched, and checksum clearing still occurs only for the original flag combination. Test Plan: - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings` -- passed - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets -- -D warnings` -- passed - `ulimit -v 41943040; cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check` -- passed - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/cli/Cargo.toml --all-targets` -- passed, 190 tests - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 make -j1` -- passed - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 ./tests/rustLibSmoke` -- passed - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 make -j1 -C tests test` -- passed, including large streaming, native, fuzzer, and zstream phases
This commit is contained in:
@@ -545,6 +545,7 @@ enum {
|
||||
};
|
||||
typedef void (*ZSTDMT_prepareJobFn)(void* opaque, unsigned jobID,
|
||||
const ZSTDMT_RustJobInitialization* init);
|
||||
typedef void (*ZSTDMT_prepareFrameStateFn)(void* opaque);
|
||||
typedef void (*ZSTDMT_writeEmptyJobFn)(void* opaque, unsigned jobID);
|
||||
typedef int (*ZSTDMT_tryAddJobFn)(void* opaque, unsigned jobID);
|
||||
void ZSTDMT_rust_prepareCompressionJob(
|
||||
@@ -552,7 +553,8 @@ void ZSTDMT_rust_prepareCompressionJob(
|
||||
const ZSTDMT_RustJobInitialization* initialization,
|
||||
ZSTDMT_prepareJobFn initializeJob,
|
||||
ZSTDMT_prepareJobFn resetInputState,
|
||||
ZSTDMT_prepareJobFn publishFrameState);
|
||||
ZSTDMT_prepareFrameStateFn setFrameEnded,
|
||||
ZSTDMT_prepareFrameStateFn clearChecksumFlag);
|
||||
ZSTDMT_RustCreateJobResult ZSTDMT_rust_createCompressionJob(
|
||||
const ZSTDMT_RustCreateJobProjection* projection,
|
||||
void* opaque, ZSTDMT_prepareJobFn prepareJob,
|
||||
@@ -2931,17 +2933,16 @@ static void ZSTDMT_prepareCompressionJobInputState(
|
||||
};
|
||||
}
|
||||
|
||||
static void ZSTDMT_prepareCompressionJobFrameState(
|
||||
void* opaque, unsigned jobID,
|
||||
const ZSTDMT_RustJobInitialization* initialization)
|
||||
static void ZSTDMT_prepareCompressionJobSetFrameEnded(void* opaque)
|
||||
{
|
||||
ZSTDMT_CCtx* const mtctx = (ZSTDMT_CCtx*)opaque;
|
||||
(void)jobID;
|
||||
if (initialization->lastJob) {
|
||||
mtctx->frameEnded = 1;
|
||||
if (initialization->clearChecksumFlag)
|
||||
mtctx->params.fParams.checksumFlag = 0;
|
||||
}
|
||||
mtctx->frameEnded = 1;
|
||||
}
|
||||
|
||||
static void ZSTDMT_prepareCompressionJobClearChecksumFlag(void* opaque)
|
||||
{
|
||||
ZSTDMT_CCtx* const mtctx = (ZSTDMT_CCtx*)opaque;
|
||||
mtctx->params.fParams.checksumFlag = 0;
|
||||
}
|
||||
|
||||
static void ZSTDMT_prepareCompressionJob(
|
||||
@@ -2952,7 +2953,8 @@ static void ZSTDMT_prepareCompressionJob(
|
||||
opaque, jobID, initialization,
|
||||
ZSTDMT_prepareCompressionJobDescriptor,
|
||||
ZSTDMT_prepareCompressionJobInputState,
|
||||
ZSTDMT_prepareCompressionJobFrameState);
|
||||
ZSTDMT_prepareCompressionJobSetFrameEnded,
|
||||
ZSTDMT_prepareCompressionJobClearChecksumFlag);
|
||||
}
|
||||
|
||||
static void ZSTDMT_writeEmptyCompressionJob(void* opaque, unsigned jobID)
|
||||
|
||||
Reference in New Issue
Block a user