Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jovany-wang opened this issue Sep 27, 2021 · 2 comments
Open

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

jovany-wang opened this issue Sep 27, 2021 · 2 comments
Assignees
Labels

Comments

@jovany-wang
Copy link
Collaborator

jovany-wang commented Sep 27, 2021

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() {
}
@jovany-wang
Copy link
Collaborator Author

jovany-wang commented Sep 27, 2021

@jovany-wang
Copy link
Collaborator Author

Note that this is very important to support our slogan:
A Raft implementation to help build your Raft service in 1 minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants