2 * Copyright (c) Meta Platforms, Inc. and affiliates.
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
21 * The base class for state that methods keep.
22 * All derived method state classes must have a member of this type.
29 * A method that compresses the data using config.
32 char const* name; /**< The identifier for this method in the results. */
34 * Creates a state that must contain a member variable of method_state_t,
35 * and returns a pointer to that member variable.
37 * This method can be used to do expensive work that only depends on the
38 * data, like loading the data file into a buffer.
40 method_state_t* (*create)(data_t const* data);
42 * Compresses the data in the state using the given config.
44 * @param state A pointer to the state returned by create().
46 * @returns The total compressed size on success, or an error code.
48 result_t (*compress)(method_state_t* state, config_t const* config);
52 void (*destroy)(method_state_t* state);
56 * Set the zstd cli path. Must be called before any methods are used.
58 void method_set_zstdcli(char const* zstdcli);
61 * A NULL-terminated list of methods.
63 extern method_t const* const* methods;