Skip to content

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

Open

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

  1. jovany-wang commented on Sep 27, 2021

    @jovany-wang
    CollaboratorAuthor
  2. jovany-wang commented on Sep 27, 2021

    @jovany-wang
    CollaboratorAuthor

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

  3. self-assigned this
    on Sep 28, 2021
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