mirror of
https://github.com/wassname/ray.git
synced 2026-07-25 13:30:52 +08:00
Fix clang-cl build (#9494)
Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
|
||||
#include "ray/util/logging.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/async.h"
|
||||
}
|
||||
|
||||
RedisAsioClient::RedisAsioClient(boost::asio::io_service &io_service,
|
||||
ray::gcs::RedisAsyncContext &redis_async_context)
|
||||
: redis_async_context_(redis_async_context),
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
#include <boost/asio/error.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "hiredis/async.h"
|
||||
#include "hiredis/hiredis.h"
|
||||
#include "ray/gcs/redis_async_context.h"
|
||||
|
||||
class RedisAsioClient {
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include "ray/common/ray_config.h"
|
||||
#include "ray/gcs/gcs_client/service_based_accessor.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace ray {
|
||||
namespace gcs {
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "gcs_redis_failure_detector.h"
|
||||
#include "ray/common/ray_config.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace ray {
|
||||
namespace gcs {
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
#include <mutex>
|
||||
#include "ray/common/status.h"
|
||||
|
||||
// These are forward declarations from hiredis.
|
||||
extern "C" {
|
||||
#include "hiredis/async.h"
|
||||
#include "hiredis/hiredis.h"
|
||||
struct redisAsyncContext;
|
||||
struct redisReply;
|
||||
typedef void redisCallbackFn(struct redisAsyncContext *, void *, void *);
|
||||
}
|
||||
|
||||
namespace ray {
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include "ray/common/ray_config.h"
|
||||
#include "ray/gcs/redis_context.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace ray {
|
||||
|
||||
namespace gcs {
|
||||
|
||||
@@ -445,6 +445,10 @@ Status RedisContext::PublishAsync(const std::string &channel, const std::string
|
||||
return RunArgvAsync(args, redisCallback);
|
||||
}
|
||||
|
||||
void RedisContext::FreeRedisReply(void *reply) { return freeReplyObject(reply); }
|
||||
|
||||
int RedisContext::GetRedisError(redisContext *context) { return context->err; }
|
||||
|
||||
} // namespace gcs
|
||||
|
||||
} // namespace ray
|
||||
|
||||
@@ -28,11 +28,6 @@
|
||||
#include "ray/gcs/redis_async_context.h"
|
||||
#include "ray/protobuf/gcs.pb.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/async.h"
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
struct redisContext;
|
||||
struct redisAsyncContext;
|
||||
|
||||
@@ -289,6 +284,10 @@ class RedisContext {
|
||||
boost::asio::io_service &io_service() { return io_service_; }
|
||||
|
||||
private:
|
||||
// These functions avoid problems with dependence on hiredis headers with clang-cl.
|
||||
static int GetRedisError(redisContext *context);
|
||||
static void FreeRedisReply(void *reply);
|
||||
|
||||
boost::asio::io_service &io_service_;
|
||||
redisContext *context_;
|
||||
std::unique_ptr<RedisAsyncContext> redis_async_context_;
|
||||
@@ -352,12 +351,12 @@ std::shared_ptr<CallbackReply> RedisContext::RunSync(
|
||||
id.Data(), id.Size());
|
||||
}
|
||||
if (redis_reply == nullptr) {
|
||||
RAY_LOG(INFO) << "Run redis command failed , err is " << context_->err;
|
||||
RAY_LOG(INFO) << "Run redis command failed , err is " << GetRedisError(context_);
|
||||
return nullptr;
|
||||
} else {
|
||||
std::shared_ptr<CallbackReply> callback_reply =
|
||||
std::make_shared<CallbackReply>(reinterpret_cast<redisReply *>(redis_reply));
|
||||
freeReplyObject(redis_reply);
|
||||
FreeRedisReply(redis_reply);
|
||||
return callback_reply;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "ray/common/ray_config.h"
|
||||
#include "ray/gcs/redis_gcs_client.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
static const std::string kTableAppendCommand = "RAY.TABLE_APPEND";
|
||||
|
||||
@@ -14,17 +14,16 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
// TODO(pcm): get rid of this and replace with the type safe plasma event loop
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
#include "ray/common/ray_config.h"
|
||||
#include "ray/common/test_util.h"
|
||||
#include "ray/gcs/pb_util.h"
|
||||
#include "ray/gcs/redis_gcs_client.h"
|
||||
#include "ray/gcs/tables.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace ray {
|
||||
|
||||
namespace gcs {
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "ray/object_manager/object_manager.h"
|
||||
#include "ray/util/filesystem.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace ray {
|
||||
|
||||
using rpc::GcsNodeInfo;
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
#include "ray/common/test_util.h"
|
||||
#include "ray/util/filesystem.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hiredis/hiredis.h"
|
||||
}
|
||||
|
||||
namespace {
|
||||
int64_t wait_timeout_ms;
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user