mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 16:33:53 +01:00
ircd: We don't need this here; RocksDB has interface.
This commit is contained in:
parent
58c26b616c
commit
2bca92d85d
5 changed files with 0 additions and 179 deletions
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* charybdis: 21st Century IRC++d
|
||||
*
|
||||
* Copyright (C) 2017 Charybdis Development Team
|
||||
* Copyright (C) 2017 Jason Volk <jason@zemos.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_CUCKOO_H
|
||||
|
||||
/// Cuckoo filtering and hashing.
|
||||
///
|
||||
/// This is an API for building cuckoo filters for efficient set membership
|
||||
/// tests. Cuckoo filters are a recently celebrated result by Bin Fan inspired
|
||||
/// by Mitzenmacher's seminal thesis: the Power Of Two choices in randomized
|
||||
/// linear load balancing. These filters are used extensively to optimize
|
||||
/// queries made into matrix room state after accumulating events.
|
||||
///
|
||||
/// Note that the hash residue has to be kept secret from an adversary who
|
||||
/// may try to craft strings to attack the filter. A secret salt should be
|
||||
/// used. Filters may also be serialized to the db so the salt will have to
|
||||
/// persist secretly too.
|
||||
///
|
||||
namespace ircd::cuckoo
|
||||
{
|
||||
IRCD_EXCEPTION(ircd::error, error)
|
||||
|
||||
template<class word, size_t words> struct entry;
|
||||
template<class entry, size_t entries> struct bucket;
|
||||
template<class bucket, size_t buckets> struct table;
|
||||
|
||||
struct filter;
|
||||
struct counter;
|
||||
}
|
||||
|
||||
template<class word,
|
||||
size_t words>
|
||||
struct ircd::cuckoo::entry
|
||||
:std::array<word, words>
|
||||
{
|
||||
using array_type = std::array<word, words>;
|
||||
|
||||
};
|
||||
|
||||
template<class entry,
|
||||
size_t entries>
|
||||
struct ircd::cuckoo::bucket
|
||||
:std::array<entry, entries>
|
||||
{
|
||||
using array_type = std::array<entry, entries>;
|
||||
|
||||
};
|
||||
|
||||
template<class bucket,
|
||||
size_t buckets>
|
||||
struct ircd::cuckoo::table
|
||||
:std::array<bucket, buckets>
|
||||
{
|
||||
using array_type = std::array<bucket, buckets>;
|
||||
|
||||
static_assert(is_powerof2(buckets), "Bucket count must be power of 2");
|
||||
};
|
||||
|
||||
struct ircd::cuckoo::filter
|
||||
{
|
||||
using entry = cuckoo::entry<uint8_t, 1>;
|
||||
using bucket = cuckoo::bucket<entry, 1>;
|
||||
using table = cuckoo::table<bucket, 32>;
|
||||
|
||||
table a, b;
|
||||
|
||||
bool has(const string_view &) const;
|
||||
|
||||
void add(const string_view &);
|
||||
void del(const string_view &);
|
||||
};
|
||||
|
||||
struct ircd::cuckoo::counter
|
||||
{
|
||||
using int_t = int32_t;
|
||||
using entry = cuckoo::entry<int_t, 1>;
|
||||
using bucket = cuckoo::bucket<entry, 1>;
|
||||
using table = cuckoo::table<bucket, 32>;
|
||||
|
||||
table a, b;
|
||||
|
||||
int_t count(const string_view &) const;
|
||||
bool has(const string_view &) const;
|
||||
|
||||
void add(const string_view &);
|
||||
void del(const string_view &);
|
||||
};
|
|
@ -22,8 +22,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ircd/cuckoo.h>
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_M_VM_H
|
||||
|
||||
|
|
|
@ -221,7 +221,6 @@ namespace ircd
|
|||
#include "tokens.h"
|
||||
#include "params.h"
|
||||
#include "iov.h"
|
||||
#include "cuckoo.h"
|
||||
#include "parse.h"
|
||||
#include "rfc1459.h"
|
||||
#include "json/json.h"
|
||||
|
|
|
@ -63,7 +63,6 @@ libircd_la_SOURCES = \
|
|||
hash.cc \
|
||||
rand.cc \
|
||||
ctx.cc \
|
||||
cuckoo.cc \
|
||||
db.cc \
|
||||
exception.cc \
|
||||
fmt.cc \
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* charybdis: 21st Century IRC++d
|
||||
*
|
||||
* Copyright (C) 2017 Charybdis Development Team
|
||||
* Copyright (C) 2017 Jason Volk <jason@zemos.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace ircd::cuckoo
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ircd::cuckoo::counter::add(const string_view &s)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ircd::cuckoo::counter::del(const string_view &s)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::cuckoo::counter::has(const string_view &s)
|
||||
const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ircd::cuckoo::counter::int_t
|
||||
ircd::cuckoo::counter::count(const string_view &s)
|
||||
const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ircd::cuckoo::filter::add(const string_view &s)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ircd::cuckoo::filter::del(const string_view &s)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::cuckoo::filter::has(const string_view &s)
|
||||
const
|
||||
{
|
||||
return false;
|
||||
}
|
Loading…
Reference in a new issue