GitLab maintenance scheduled for Tomorrow, 2019-09-24, from 12:00 to 13:00 CT - Services will be unavailable during this time.

Commit 1bcea916 authored by Matthieu Dorier's avatar Matthieu Dorier

implementing server

parent cd5b6ba0
......@@ -20,6 +20,7 @@ extern "C" {
#define REMI_ERR_UNKNOWN_META -7 /* Unknown metadata entry */
#define REMI_ERR_SIZE -8 /* Client did not allocate enough for the requested data */
#define REMI_ERR_MIGRATION -9 /* Error during data migration */
#define REMI_ERR_CLASS_EXISTS -10 /* Migration class already registered */
typedef struct remi_fileset* remi_fileset_t;
#define REMI_FILESET_NULL ((remi_fileset_t)0)
......
......@@ -8,8 +8,7 @@ extern "C" {
#endif
#define REMI_ABT_POOL_DEFAULT ABT_POOL_NULL
#define REMI_PROVIDER_ID_DEFAULT 1
#define REMI_PROVIDER_IGNORE NULL
#define REMI_PROVIDER_ID_DEFAULT 0
typedef struct remi_provider* remi_provider_t;
#define REMI_PROVIDER_NULL ((remi_provider_t)0)
......@@ -23,7 +22,7 @@ int remi_provider_register(
ABT_pool pool,
remi_provider_t* provider);
int remi_provider_add_migration_class(
int remi_provider_register_migration_class(
remi_provider_t provider,
const char* class_name,
remi_migration_callback_t callback,
......
#include <remi/remi-server.h>
#include <thallium.hpp>
#include "remi/remi-server.h"
#include "remi-fileset.hpp"
#if 0
typedef struct remi_provider* remi_provider_t;
#define REMI_PROVIDER_NULL ((remi_provider_t)0)
namespace tl = thallium;
typedef void (*remi_migration_callback_t)(remi_provider_t, remi_fileset_t, void*);
#define REMI_MIGRATION_CALLBACK_NULL ((remi_migration_callback_t)0)
struct migration_class {
remi_migration_callback_t m_callback;
void* m_uargs;
};
#endif
struct remi_provider : public tl::provider<remi_provider> {
std::unordered_map<std::string, migration_class> m_migration_classes;
tl::engine* m_engine;
int32_t migrate(
const tl::request& req,
remi_fileset& fileset,
const std::vector<std::size_t>& filesizes,
tl::bulk& remote_bulk)
{
// TODO
return REMI_SUCCESS;
}
remi_provider(tl::engine* e, uint16_t provider_id, tl::pool& pool)
: tl::provider<remi_provider>(*e, provider_id) {
define("remi_migrate", &remi_provider::migrate);
}
};
static void on_finalize(void* uargs) {
auto provider = static_cast<remi_provider_t>(uargs);
delete provider->m_engine;
}
extern "C" int remi_provider_register(
margo_instance_id mid,
......@@ -15,14 +42,26 @@ extern "C" int remi_provider_register(
ABT_pool pool,
remi_provider_t* provider)
{
auto thePool = tl::pool(pool);
auto theEngine = new tl::engine(mid, THALLIUM_SERVER_MODE);
auto theProvider = new remi_provider(theEngine, provider_id, thePool);
margo_push_finalize_callback(mid, on_finalize, theProvider);
*provider = theProvider;
return REMI_SUCCESS;
}
extern "C" int remi_provider_add_migration_class(
extern "C" int remi_provider_register_migration_class(
remi_provider_t provider,
const char* class_name,
remi_migration_callback_t callback,
void* uargs)
{
if(provider == REMI_PROVIDER_NULL || class_name == NULL)
return REMI_ERR_INVALID_ARG;
if(provider->m_migration_classes.count(class_name) != 0)
return REMI_ERR_CLASS_EXISTS;
auto& klass = provider->m_migration_classes[class_name];
klass.m_callback = callback;
klass.m_uargs = uargs;
return REMI_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment