0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd:Ⓜ️:rooms: Split rooms::summary header.

This commit is contained in:
Jason Volk 2019-09-14 17:44:49 -07:00
parent 35c37f6a67
commit 6450d38c04
3 changed files with 51 additions and 38 deletions

View file

@ -56,6 +56,7 @@ namespace ircd::m
#include "user/user.h"
#include "users.h"
#include "rooms.h"
#include "rooms_summary.h"
#include "filter.h"
#include "events.h"
#include "node.h"

View file

@ -27,44 +27,6 @@ namespace ircd::m::rooms
bool has(const opts & = opts_default);
}
/// Interface to tools that build a publicrooms summary from room state.
namespace ircd::m::rooms::summary
{
struct fetch;
// util
string_view make_state_key(const mutable_buffer &, const room::id &);
room::id::buf unmake_state_key(const string_view &);
// observers
bool has(const room::id &);
void chunk(const room &, json::stack::object &chunk);
json::object chunk(const room &, const mutable_buffer &out);
// mutators
event::id::buf set(const room::id &, const json::object &summary);
event::id::buf set(const room &);
event::id::buf del(const room &);
}
struct ircd::m::rooms::summary::fetch
{
// conf
static conf::item<size_t> limit;
static conf::item<seconds> timeout;
// result
size_t total_room_count_estimate {0};
std::string next_batch;
// request
fetch(const string_view &origin,
const string_view &since = {},
const size_t &limit = 64);
fetch() = default;
};
/// Arguments structure to rooms::for_each(). This reduces the API surface to
/// handle a rich set of ways to iterate over the rooms.
struct ircd::m::rooms::opts

View file

@ -0,0 +1,50 @@
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2019 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. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_M_ROOMS_SUMMARY_H
/// Interface to tools that build a publicrooms summary from room state.
namespace ircd::m::rooms::summary
{
struct fetch;
// util
string_view make_state_key(const mutable_buffer &, const room::id &);
room::id::buf unmake_state_key(const string_view &);
// observers
bool has(const room::id &);
void chunk(const room &, json::stack::object &chunk);
json::object chunk(const room &, const mutable_buffer &out);
// mutators
event::id::buf set(const room::id &, const json::object &summary);
event::id::buf set(const room &);
event::id::buf del(const room &);
}
struct ircd::m::rooms::summary::fetch
{
// conf
static conf::item<size_t> limit;
static conf::item<seconds> timeout;
// result
size_t total_room_count_estimate {0};
std::string next_batch;
// request
fetch(const string_view &origin,
const string_view &since = {},
const size_t &limit = 64);
fetch() = default;
};