Skip to content

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

Open
@jovany-wang

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() {
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions