LCOV - code coverage report
Current view: top level - home/snapwebsites/snapcpp/snapwebsites/snapdatabase/snapdatabase/file - file_snap_database_table.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2019-12-15 17:13:15 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2019  Made to Order Software Corp.  All Rights Reserved
       2             : //
       3             : // https://snapwebsites.org/project/snapdatabase
       4             : // contact@m2osw.com
       5             : //
       6             : // This program is free software; you can redistribute it and/or modify
       7             : // it under the terms of the GNU General Public License as published by
       8             : // the Free Software Foundation; either version 2 of the License, or
       9             : // (at your option) any later version.
      10             : //
      11             : // This program is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : // GNU General Public License for more details.
      15             : //
      16             : // You should have received a copy of the GNU General Public License along
      17             : // with this program; if not, write to the Free Software Foundation, Inc.,
      18             : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      19             : #pragma once
      20             : 
      21             : 
      22             : /** \file
      23             :  * \brief Block representing the database file header.
      24             :  *
      25             :  */
      26             : 
      27             : // self
      28             : //
      29             : #include    "snapdatabase/data/structure.h"
      30             : 
      31             : 
      32             : 
      33             : 
      34             : 
      35             : namespace snapdatabase
      36             : {
      37             : 
      38             : 
      39             : 
      40             : /** \brief The type of Bloom Filter.
      41             :  *
      42             :  * We want to support multiple implementations to help with the ignorance
      43             :  * of what is best.
      44             :  *
      45             :  * * None
      46             :  *
      47             :  *     Means that no Bloom Filter is used (good for _tiny_ tables).
      48             :  *
      49             :  * * One
      50             :  *
      51             :  *     Means that we use a single buffer for all the hashes. That means
      52             :  *     we may have some overlap (although this is how it usually is
      53             :  *     implemented).
      54             :  *
      55             :  * * N
      56             :  *
      57             :  *     Means we use one buffer per hash. No overlap, but instead of
      58             :  *     a one time 250Kb buffer, we need something like N x 250Kb
      59             :  *     (where N is the number of hashes).
      60             :  *
      61             :  *     Keep in mind that N is generally pretty large (i.e. 7 to 23).
      62             :  *     So it's not cheap.
      63             :  *
      64             :  * * Bits
      65             :  *
      66             :  *     Means that the filter is just bits: 0 no luck, 1 row exists.
      67             :  *
      68             :  *     As a result, this Bloom Filters are not good with tables where
      69             :  *     many deletion occur because ultimately you get so many false
      70             :  *     positives that the filter could just be ignored. To fix the
      71             :  *     problem you have to regenerate the Bloom Filter from scratch.
      72             :  *
      73             :  * * Counters
      74             :  *
      75             :  *     Means that we use 8 bits and count how many rows make use
      76             :  *     of that bit. That way we can decrement the counter later when
      77             :  *     the row gets deleted. So this is best for tables that have many
      78             :  *     deletes.
      79             :  *
      80             :  *     Note that if the counter reaches the maximum (255 for us since we
      81             :  *     plane to use 8 bits for each counter), you have a similar problem
      82             :  *     as with the Bits version above. You have to reference the
      83             :  *     entire filter with a large Bloom Filter.
      84             :  */
      85             : enum class bloom_filter_algorithm_t : uint8_t
      86             : {
      87             :     BLOOM_FILTER_ALGORITHM_NONE          = 0,
      88             :     BLOOM_FILTER_ALGORITHM_ONE_BITS      = 1,
      89             :     BLOOM_FILTER_ALGORITHM_ONE_COUNTERS  = 2,
      90             :     BLOOM_FILTER_ALGORITHM_N_BITS        = 3,
      91             :     BLOOM_FILTER_ALGORITHM_N_COUNTERS    = 4,
      92             : };
      93             : 
      94             : 
      95             : 
      96           0 : class file_snap_database_table
      97             :     : public block
      98             : {
      99             : public:
     100             :     typedef std::shared_ptr<file_snap_database_table>       pointer_t;
     101             : 
     102             :                                 file_snap_database_table(dbfile::pointer_t f, reference_t offset);
     103             : 
     104             :     version_t                   get_file_version() const;
     105             :     void                        set_file_version(version_t v);
     106             :     reference_t                 get_first_free_block() const;
     107             :     void                        set_first_free_block(reference_t offset);
     108             :     reference_t                 get_table_definition() const;
     109             :     void                        set_table_definition(reference_t offset);
     110             :     uint32_t                    get_block_size() const;
     111             :     void                        set_block_size(uint32_t size);
     112             : 
     113             : private:
     114             :     //schema_table::pointer_t     f_schema = schema_table::pointer_t();
     115             : };
     116             : 
     117             : 
     118             : 
     119             : } // namespace snapdatabase
     120             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.13