-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
359 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#pragma once | ||
|
||
#include <boost/uuid/uuid.hpp> | ||
#include <boost/uuid/uuid_io.hpp> | ||
|
||
#include <folly/Expected.h> | ||
#include <folly/small_vector.h> | ||
#include <folly/Unit.h> | ||
#include <folly/futures/Future.h> | ||
|
||
#include <libnuraft/async.hxx> | ||
#include <sisl/fds/buffer.hpp> | ||
#include <sisl/logging/logging.h> | ||
|
||
SISL_LOGGING_DECL(nuraft) | ||
SISL_LOGGING_DECL(nuraft_mesg) | ||
|
||
namespace nuraft_mesg { | ||
|
||
using peer_id_t = boost::uuids::uuid; | ||
using group_id_t = boost::uuids::uuid; | ||
using group_type_t = std::string; | ||
|
||
using io_blob_list_t = folly::small_vector< sisl::io_blob, 4 >; | ||
|
||
template < typename T > | ||
using Result = folly::Expected< T, nuraft::cmd_result_code >; | ||
template < typename T > | ||
using AsyncResult = folly::SemiFuture< Result< T > >; | ||
|
||
} // namespace nuraft_mesg | ||
|
||
namespace fmt { | ||
template <> | ||
struct formatter< nuraft_mesg::group_id_t > { | ||
template < typename ParseContext > | ||
constexpr auto parse(ParseContext& ctx) { | ||
return ctx.begin(); | ||
} | ||
|
||
template < typename FormatContext > | ||
auto format(nuraft_mesg::group_id_t const& n, FormatContext& ctx) { | ||
return format_to(ctx.out(), "{}", to_string(n)); | ||
} | ||
}; | ||
|
||
template <> | ||
struct formatter< nuraft::cmd_result_code > { | ||
template < typename ParseContext > | ||
constexpr auto parse(ParseContext& ctx) { | ||
return ctx.begin(); | ||
} | ||
|
||
template < typename FormatContext > | ||
auto format(nuraft::cmd_result_code const& c, FormatContext& ctx) { | ||
return format_to(ctx.out(), "{}", int32_t(c)); | ||
} | ||
}; | ||
} // namespace fmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.