mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd:Ⓜ️ Dissolve m::matrix instance object; burden user instead.
This commit is contained in:
parent
fb771478ee
commit
994fc377c7
4 changed files with 32 additions and 49 deletions
|
@ -197,13 +197,10 @@ noexcept try
|
|||
{
|
||||
[&opts](const ircd::main_continuation &main)
|
||||
{
|
||||
// Load the matrix module
|
||||
ircd::matrix matrix;
|
||||
|
||||
// Construct the homeserver.
|
||||
construct::homeserver homeserver
|
||||
{
|
||||
matrix, opts
|
||||
opts
|
||||
};
|
||||
|
||||
// Bail for debug/testing purposes.
|
||||
|
|
|
@ -12,23 +12,36 @@
|
|||
#include "construct.h"
|
||||
#include "homeserver.h"
|
||||
|
||||
construct::homeserver::homeserver(ircd::matrix &matrix,
|
||||
struct ircd::m::homeserver::opts opts)
|
||||
namespace fs = ircd::fs;
|
||||
using ircd::string_view;
|
||||
|
||||
construct::homeserver::homeserver(struct ircd::m::homeserver::opts opts)
|
||||
try
|
||||
:matrix
|
||||
{
|
||||
matrix
|
||||
}
|
||||
,opts
|
||||
:opts
|
||||
{
|
||||
std::move(opts)
|
||||
}
|
||||
,module_path
|
||||
{
|
||||
fs::path_string(fs::path_views{fs::base::lib, "libircd_matrix"}),
|
||||
}
|
||||
,module
|
||||
{
|
||||
string_view{module_path[0]},
|
||||
}
|
||||
,init
|
||||
{
|
||||
module[0], "ircd::m::homeserver::init",
|
||||
}
|
||||
,fini
|
||||
{
|
||||
module[0], "ircd::m::homeserver::fini",
|
||||
}
|
||||
,hs
|
||||
{
|
||||
matrix.init(&this->opts),
|
||||
[&matrix](ircd::m::homeserver *const hs)
|
||||
this->init(&this->opts), [this](ircd::m::homeserver *const hs)
|
||||
{
|
||||
matrix.fini(hs);
|
||||
this->fini(hs);
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
|
@ -10,11 +10,17 @@
|
|||
|
||||
struct construct::homeserver
|
||||
{
|
||||
ircd::matrix &matrix;
|
||||
using init_proto = ircd::m::homeserver *(const struct ircd::m::homeserver::opts *);
|
||||
using fini_proto = void (ircd::m::homeserver *);
|
||||
|
||||
struct ircd::m::homeserver::opts opts;
|
||||
std::string module_path[1];
|
||||
ircd::module module[1];
|
||||
ircd::mods::import<init_proto> init;
|
||||
ircd::mods::import<fini_proto> fini;
|
||||
ircd::custom_ptr<ircd::m::homeserver> hs;
|
||||
|
||||
public:
|
||||
homeserver(ircd::matrix &, struct ircd::m::homeserver::opts);
|
||||
homeserver(struct ircd::m::homeserver::opts);
|
||||
~homeserver() noexcept;
|
||||
};
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace ircd::m
|
|||
/// Matrix Protocol System
|
||||
namespace ircd::m
|
||||
{
|
||||
struct matrix;
|
||||
struct homeserver;
|
||||
|
||||
IRCD_OVERLOAD(generate)
|
||||
|
@ -44,7 +43,6 @@ namespace ircd::m
|
|||
extern const uint16_t canon_port;
|
||||
extern const string_view canon_service;
|
||||
|
||||
using m::matrix;
|
||||
extern const std::vector<string_view> module_names;
|
||||
extern const std::vector<string_view> module_names_optional;
|
||||
}
|
||||
|
@ -100,34 +98,3 @@ namespace ircd::m
|
|||
#include "burst.h"
|
||||
#include "resource.h"
|
||||
#include "homeserver.h"
|
||||
|
||||
struct ircd::m::matrix
|
||||
{
|
||||
static const std::vector<string_view> module_names;
|
||||
static const std::vector<string_view> module_names_optional;
|
||||
|
||||
std::string module_path
|
||||
{
|
||||
fs::path_string(fs::path_views
|
||||
{
|
||||
fs::base::lib, "libircd_matrix"
|
||||
})
|
||||
};
|
||||
|
||||
ircd::module module
|
||||
{
|
||||
module_path
|
||||
};
|
||||
|
||||
using init_proto = m::homeserver *(const struct m::homeserver::opts *);
|
||||
mods::import<init_proto> init
|
||||
{
|
||||
module, "ircd::m::homeserver::init"
|
||||
};
|
||||
|
||||
using fini_proto = void (m::homeserver *);
|
||||
mods::import<fini_proto> fini
|
||||
{
|
||||
module, "ircd::m::homeserver::fini"
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue