<commit_before>#include <assert.h>
#include "fdf.h"

static struct FDF_state* fdf_state;
static __thread struct FDF_thread_state *_fdf_thd_state;

FDF_status_t fdf_init()
{
    return FDFInit( &fdf_state );
}

FDF_status_t fdf_shutdown()
{
    return FDFShutdown( fdf_state );
}

FDF_status_t fdf_init_thread()
{
    return FDFInitPerThreadState(fdf_state, &_fdf_thd_state);
}

FDF_status_t fdf_transaction_start()
{
    return FDFMiniTransactionStart(_fdf_thd_state);
}

FDF_status_t fdf_transaction_commit()
{
    return FDFMiniTransactionCommit(_fdf_thd_state);
}

FDF_status_t fdf_create_container (
    char                    *cname,
    uint64_t                size,
    FDF_cguid_t             *cguid
    )
{
    FDF_status_t            ret;
    FDF_container_props_t   props;
    uint32_t                flags       = FDF_CTNR_CREATE;

    FDFLoadCntrPropDefaults(&props);

    props.size_kb   = size / 1024;

    ret = FDFOpenContainer (
            _fdf_thd_state,
            cname, 
            &props,
            flags,
            cguid
            );
    
    if ( ret != FDF_SUCCESS ) 
        fprintf( stderr, "FDFOpenContainer: %s\n", FDFStrError(ret) );
    
    return ret;
}

FDF_status_t fdf_open_container (<commit_msg>#10744 Switch to new txn API for unit tests TESTS_RAN: Unit tests<commit_after>#include <assert.h>
#include "fdf.h"

static struct FDF_state* fdf_state;
static __thread struct FDF_thread_state *_fdf_thd_state;

FDF_status_t fdf_init()
{
    return FDFInit( &fdf_state );
}

FDF_status_t fdf_shutdown()
{
    return FDFShutdown( fdf_state );
}

FDF_status_t fdf_init_thread()
{
    return FDFInitPerThreadState(fdf_state, &_fdf_thd_state);
}

FDF_status_t fdf_transaction_start()
{
    return FDFTransactionStart(_fdf_thd_state);
}

FDF_status_t fdf_transaction_commit()
{
    return FDFTransactionCommit(_fdf_thd_state);
}

FDF_status_t fdf_create_container (
    char                    *cname,
    uint64_t                size,
    FDF_cguid_t             *cguid
    )
{
    FDF_status_t            ret;
    FDF_container_props_t   props;
    uint32_t                flags       = FDF_CTNR_CREATE;

    FDFLoadCntrPropDefaults(&props);

    props.size_kb   = size / 1024;

    ret = FDFOpenContainer (
            _fdf_thd_state,
            cname, 
            &props,
            flags,
            cguid
            );
    
    if ( ret != FDF_SUCCESS ) 
        fprintf( stderr, "FDFOpenContainer: %s\n", FDFStrError(ret) );
    
    return ret;
}

FDF_status_t fdf_open_container (
{'fraction_non_alphanumeric': 0.07977883096366509, 'fraction_numerical': 0.008293838862559242, 'mean_word_length': 2.4793956043956045, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6152161', 'n_tokens_mistral': 972, 'n_tokens_neox': 936, 'n_words': 159}