<commit_before>/**
 * \author      <NAME> <EMAIL>
 * \brief       Defines plasma_t control object.
 * \date        03/08/2015 05:00:23 AM
 * \file        plasma.h
 * \version     1.0
 *
 * The object controls operations of circular queue of memory buffers.
 * Each memory buffer can be read from or written to. Many reads from
 * the same buffer are possible, only one write to a buffer can happen
 * at the same time, reads and writes are mutually exclusive.
 * Circular queue is used. This means that if, for example, the last
 * element in the queue is locked for writing, a request for another
 * write will try searching writable buffers from the first element.
 **/
#ifndef PLASMA_PLASMA_H__
# define PLASMA_PLASMA_H__

# include <ionize/error.h> /* ionize_status */
# include <stdbool.h> /* bool */
# include <stddef.h> /* size_t */
# include <stdint.h> /* uint32_t */

typedef struct plasma_struct plasma;
/**
 * \brief Requests allocation of memory buffers with given sizes.
 * \param self Pointer to plasma object on which we'll operate.
 * \param sizes Array of buffer sizes.
 * \param length Length of sizes array.
 * \return Zero on success, else error code.
 */
typedef ionize_status ( * plasma_allocate_func )(
    plasma * const restrict self,
    size_t const * const restrict sizes,
    size_t const length
);
typedef struct
{
    void const * data; /** Pointer to buffer memory */
    size_t size; /** Size of buffer memory */
}
plasma_read_only;
typedef struct
{
    ionize_status status;
    plasma_read_only buf;
}
plasma_read;
/**
 * \brief Locks first available buffer for reading and returns it.
 * \param self Pointer to plasma object on which we'll operate.
 * \return Structure containing error code and read-only buffer descriptor.
 * \warning Using the buffer after unlocking it is undefined.
 */
typedef plasma_read<commit_msg>small comment on usage of allocation<commit_after>/**
 * \author      <NAME> <EMAIL>
 * \brief       Defines plasma_t control object.
 * \date        03/08/2015 05:00:23 AM
 * \file        plasma.h
 * \version     1.0
 *
 * The object controls operations of circular queue of memory buffers.
 * Each memory buffer can be read from or written to. Many reads from
 * the same buffer are possible, only one write to a buffer can happen
 * at the same time, reads and writes are mutually exclusive.
 * Circular queue is used. This means that if, for example, the last
 * element in the queue is locked for writing, a request for another
 * write will try searching writable buffers from the first element.
 **/
#ifndef PLASMA_PLASMA_H__
# define PLASMA_PLASMA_H__

# include <ionize/error.h> /* ionize_status */
# include <stdbool.h> /* bool */
# include <stddef.h> /* size_t */
# include <stdint.h> /* uint32_t */

typedef struct plasma_struct plasma;
/**
 * \brief Requests allocation of memory buffers with given sizes.
 * \param self Pointer to plasma object on which we'll operate.
 * \param sizes Array of buffer sizes.
 * \param length Length of sizes array.
 * \return Zero on success, else error code.
 *
 * Send a request for allocation to appropriate service. Allocated
 * space is added to the back of circular queue managed by the service.
 */
typedef ionize_status ( * plasma_allocate_func )(
    plasma * const restrict self,
    size_t const * const restrict sizes,
    size_t const length
);
typedef struct
{
    void const * data; /** Pointer to buffer memory */
    size_t size; /** Size of buffer memory */
}
plasma_read_only;
typedef struct
{
    ionize_status status;
    plasma_read_only buf;
}
plasma_read;
/**
 * \brief Locks first available buffer for reading and returns it.
 * \param self Pointer to plasma object on which we'll operate.
 * \return Structure containing error code and read-only buffer descriptor.
 * \warning Using the buffer after unlocking it is undefined.
 */
typedef plasma_read
{'fraction_non_alphanumeric': 0.08167997938675599, 'fraction_numerical': 0.009275959804174182, 'mean_word_length': 3.3520179372197307, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '743480', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1080, 'n_words': 492}