Skip to content

[RFC] Integrate dyanmic loading to let users easy to use. #208

Description

@jovany-wang

This RFC aims to discuss how we support the very easy to use RAFT service.

I propose this simple usage:

// my_counter_service.h

class MyCounterService {
public:
    virtual int get() const = 0;
    virtual void incr(int delta) = 0;
};
// my_counter_service_impl.h

class MyCounterServiceImpl : public MyCounterService {
public:
    int get() const { return val_; }
    void incr(int delta) { val_ += delta; }

private:
    int val_ = 0;
};

INIT_RAFT_SERVICE(MyCounterService, MyCounterService::incr, MyCounterService::get);
/// server.h

#include "my_counter_service_impl.h"

int main() {
    raftcpp::Loop();
}
/// client.h

#include "my_counter_service.h"
int main() {
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions