<commit_before>// database_impl.h
//
#pragma once
#ifndef __SDL_SYSTEM_DATABASE_IMPL_H__
#define __SDL_SYSTEM_DATABASE_IMPL_H__

#include "dataserver/common/map_enum.h"
#include "dataserver/common/compact_map.h"
#include "dataserver/system/page_map.h"
#if SDL_USE_BPOOL
#include "dataserver/bpool/page_bpool.h"
#endif

namespace sdl { namespace db {

class database_PageMapping : noncopyable {
#if SDL_USE_BPOOL
    using page_bpool = bpool::page_bpool;
#else
    using page_bpool = const PageMapping;
#endif
    page_bpool m_pool;
public:
    explicit database_PageMapping(const std::string & fname)
#if SDL_USE_BPOOL && defined(SDL_OS_WIN32) && SDL_DEBUG
        : m_pool(fname) //, megabyte<1>::value, megabyte<2>::value) //FIXME: test low memory
#else
        : m_pool(fname)
#endif
    {}
    ~database_PageMapping() {
#if SDL_USE_BPOOL && defined(SDL_OS_WIN32) && SDL_DEBUG
        //m_pool.unlock_thread(true);
#endif
    }
    page_bpool & pool() {
        return m_pool;
    }
    page_bpool const & const_pool() const {
        return m_pool;
    }
};

class database::shared_data final : public database_PageMapping {
    using map_sysalloc = compact_map<schobj_id, shared_sysallocunits>;
    using map_datapage = compact_map<schobj_id, shared_page_head_access>;
    using map_index = compact_map<schobj_id, pgroot_pgfirst>;
    using map_primary = compact_map<schobj_id, shared_primary_key>;
    using map_cluster = compact_map<schobj_id, shared_cluster_index>;
    using map_spatial_tree = compact_map<schobj_id, spatial_tree_idx>;
    struct data_type {
        shared_usertables usertable;
        shared_usertables internal;
        shared_datatables datatable;<commit_msg>database_PageMapping<commit_after>// database_impl.h
//
#pragma once
#ifndef __SDL_SYSTEM_DATABASE_IMPL_H__
#define __SDL_SYSTEM_DATABASE_IMPL_H__

#include "dataserver/common/map_enum.h"
#include "dataserver/common/compact_map.h"
#include "dataserver/system/page_map.h"
#if SDL_USE_BPOOL
#include "dataserver/bpool/page_bpool.h"
#endif

namespace sdl { namespace db {

class database_PageMapping : noncopyable {
#if SDL_USE_BPOOL
    using page_bpool = bpool::page_bpool;
#else
    using page_bpool = const PageMapping;
#endif
    page_bpool m_pool;
public:
    explicit database_PageMapping(const std::string & fname)
        : m_pool(fname)
    {}
    ~database_PageMapping() {}
    page_bpool & pool() {
        return m_pool;
    }
    page_bpool const & const_pool() const {
        return m_pool;
    }
};

class database::shared_data final : public database_PageMapping {
    using map_sysalloc = compact_map<schobj_id, shared_sysallocunits>;
    using map_datapage = compact_map<schobj_id, shared_page_head_access>;
    using map_index = compact_map<schobj_id, pgroot_pgfirst>;
    using map_primary = compact_map<schobj_id, shared_primary_key>;
    using map_cluster = compact_map<schobj_id, shared_cluster_index>;
    using map_spatial_tree = compact_map<schobj_id, spatial_tree_idx>;
    struct data_type {
        shared_usertables usertable;
        shared_usertables internal;
        shared_datatables datatable;
{'fraction_non_alphanumeric': 0.08982996470965672, 'fraction_numerical': 0.0019249278152069298, 'mean_word_length': 4.508833922261484, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '3809837', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1090, 'n_words': 204}