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:
parent
35c37f6a67
commit
6450d38c04
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
50
include/ircd/m/rooms_summary.h
Normal file
50
include/ircd/m/rooms_summary.h
Normal 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;
|
||||
};
|
Loading…
Reference in a new issue