dm_zstd Module

Abstraction layer over Zstandard (zstd).


Uses

  • module~~dm_zstd~~UsesGraph module~dm_zstd dm_zstd iso_c_binding iso_c_binding module~dm_zstd->iso_c_binding module~dm_error dm_error module~dm_zstd->module~dm_error module~dm_kind dm_kind module~dm_zstd->module~dm_kind zstd zstd module~dm_zstd->zstd module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env

Used by

  • module~~dm_zstd~~UsedByGraph module~dm_zstd dm_zstd module~dm_z dm_z module~dm_z->module~dm_zstd module~dmpack dmpack module~dmpack->module~dm_zstd module~dmpack->module~dm_z module~dm_rpc dm_rpc module~dmpack->module~dm_rpc proc~dm_rpc_post_types dm_rpc_post_types proc~dm_rpc_post_types->module~dm_zstd module~dm_rpc->module~dm_z

Interfaces

public interface dm_zstd_compress

Generic Zstandard compression function.

  • private function zstd_compress_multi(context, input, output, level, input_len, output_len) result(rc)

    Compresses input string using the zstd simple context function. If no compression level is passed, the Zstandard default is used. The Zstandard context context has to be destroy with dm_zstd_destroy() once finished.

    The string output may be larger than the actual length. The argument output_len contains the actual length.

    The function returns the following error codes:

    • E_ALLOC if the allocation of the output string failed.
    • E_EMPTY if the compressed size is 0.
    • E_ZSTD if the compression failed.

    Arguments

    Type IntentOptional Attributes Name
    type(zstd_context_type), intent(inout) :: context

    Zstandard context type.

    character(len=*), intent(inout) :: input

    Input bytes.

    character(len=:), intent(out), allocatable :: output

    Output bytes.

    integer, intent(in), optional :: level

    Compression level.

    integer(kind=i8), intent(in), optional :: input_len

    Actual input length.

    integer(kind=i8), intent(out), optional :: output_len

    Actual output length.

    Return Value integer

  • private function zstd_compress_single(input, output, level, input_len, output_len) result(rc)

    Compresses input string using the zstd simple function. If no compression level is passed, the Zstandard default is used.

    The string output may be larger than the actual length. The argument output_len contains the actual length.

    The function returns the following error codes:

    • E_ALLOC if the allocation of the output string failed.
    • E_EMPTY if the compressed size is 0.
    • E_ZSTD if the compression failed.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(inout) :: input

    Input bytes.

    character(len=:), intent(out), allocatable :: output

    Output bytes.

    integer, intent(in), optional :: level

    Compression level.

    integer(kind=i8), intent(in), optional :: input_len

    Actual input length.

    integer(kind=i8), intent(out), optional :: output_len

    Actual output length.

    Return Value integer

public interface dm_zstd_uncompress

Generic Zstandard decompression function.

  • private function zstd_uncompress_multi(context, input, output, input_len, output_len) result(rc)

    Uncompresses input string using the zstd simple context function. The output buffer must be large enough to hold the uncompressed result. The function returns E_ZSTD if the decompression failed. The Zstandard context type context has to be destroyed with dm_zstd_destroy() once finished.

    Arguments

    Type IntentOptional Attributes Name
    type(zstd_context_type), intent(inout) :: context

    Zstandard context type.

    character(len=*), intent(inout) :: input

    Input bytes.

    character(len=*), intent(inout) :: output

    Output bytes.

    integer(kind=i8), intent(in), optional :: input_len

    Actual input length.

    integer(kind=i8), intent(out), optional :: output_len

    Actual output length.

    Return Value integer

  • private function zstd_uncompress_single(input, output, input_len, output_len) result(rc)

    Uncompresses input string using the zstd simple function. The output buffer must be large enough to hold the uncompressed result. The function returns E_ZSTD if the decompression failed.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(inout) :: input

    Input bytes.

    character(len=*), intent(inout) :: output

    Output bytes.

    integer(kind=i8), intent(in), optional :: input_len

    Actual input length.

    integer(kind=i8), intent(out), optional :: output_len

    Actual output length.

    Return Value integer


Derived Types

type, public ::  zstd_context_type

Opaque Zstandard context type.


Functions

public function dm_zstd_destroy(context) result(rc)

Destroys Zstandard context created with zstd_compress_multi() or zstd_uncompress_multi(). The function returns E_ZSTD on error.

Arguments

Type IntentOptional Attributes Name
type(zstd_context_type), intent(inout) :: context

Zstandard context type.

Return Value integer

public function dm_zstd_level_default() result(level)

Returns default zstd compression level.

Arguments

None

Return Value integer

public function dm_zstd_level_max() result(level)

Returns maximum zstd compression level.

Arguments

None

Return Value integer

public function dm_zstd_level_min() result(level)

Returns minimum zstd compression level.

Arguments

None

Return Value integer

public function dm_zstd_version(name) result(version)

Returns zstd library version as allocatable string.

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: name

Add prefix libzstd/.

Return Value character(len=:), allocatable