<commit_before>#pragma once

#include <bench/tests/qdb/qdb_test_template.hpp>
#include <utils/random.hpp>

namespace bench
{
namespace tests
{
namespace qdb
{
namespace stream
{
class write : public qdb_test_template<write>
{
public:
    explicit write(bench::test_config config) : qdb_test_template(config)
    {
        _content = utils::create_random_string(config.content_size);
    }

    void setup() override
    {
        qdb_test_template::setup();
        _stream = _qdb.stream_open(alias(0), qdb_stream_mode_write);
    }

    void run_iteration(unsigned long iteration)
    {
        _stream.write(_content);
    }

    void cleanup() override
    {
        _stream.close();
        _qdb.stream_remove(alias(0));
    }

    static std::string name()
    {
        return "qdb_stream_write";
    }

    static std::string description()
    {
        return "Each thread repeats qdb_stream_write() on one entry";
    }

    static bool size_dependent()
    {
        return true;
    }

private:
    std::string _content;
    qdb_stream_facade _stream;
};
} // namespace stream
} // namespace qdb
} // namespace tests
} // namespace bench
<commit_msg>Rename qdb_stream_mode_write to qdb_stream_mode_append<commit_after>#pragma once

#include <bench/tests/qdb/qdb_test_template.hpp>
#include <utils/random.hpp>

namespace bench
{
namespace tests
{
namespace qdb
{
namespace stream
{
class write : public qdb_test_template<write>
{
public:
    explicit write(bench::test_config config) : qdb_test_template(config)
    {
        _content = utils::create_random_string(config.content_size);
    }

    void setup() override
    {
        qdb_test_template::setup();
        _stream = _qdb.stream_open(alias(0), qdb_stream_mode_append);
    }

    void run_iteration(unsigned long iteration)
    {
        _stream.write(_content);
    }

    void cleanup() override
    {
        _stream.close();
        _qdb.stream_remove(alias(0));
    }

    static std::string name()
    {
        return "qdb_stream_write";
    }

    static std::string description()
    {
        return "Each thread repeats qdb_stream_write() on one entry";
    }

    static bool size_dependent()
    {
        return true;
    }

private:
    std::string _content;
    qdb_stream_facade _stream;
};
} // namespace stream
} // namespace qdb
} // namespace tests
} // namespace bench

{'fraction_non_alphanumeric': 0.10490693739424704, 'fraction_numerical': 0.001692047377326565, 'mean_word_length': 2.915562913907285, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6792847', 'n_tokens_mistral': 759, 'n_tokens_neox': 748, 'n_words': 155}