mirror of
https://github.com/wassname/ray.git
synced 2026-08-18 12:20:14 +08:00
First Part of Internal Ray API Refactor (#1173)
* add Ray status class * add C++ util files * add ID types * more APIs * build system integration * add test infrastructure and implement some APIs * add more tests * fix bugs * add task table tests * update * add toolchain file * fix * test * link with pthread * update * fix * more fixes * fixes * always vendor gtest and gflags * linting * fixes * add constants file * comments * more fixes * fix linting
This commit is contained in:
committed by
Robert Nishihara
parent
c5c83a4465
commit
cac5f47600
@@ -22,6 +22,8 @@ if (NOT TARGET flatbuffers_ep)
|
||||
"-DFLATBUFFERS_BUILD_TESTS=OFF")
|
||||
endif()
|
||||
|
||||
set(FBS_DEPENDS flatbuffers_ep)
|
||||
|
||||
set(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_PREFIX}/include")
|
||||
set(FLATBUFFERS_STATIC_LIB "${FLATBUFFERS_PREFIX}/lib/libflatbuffers.a")
|
||||
set(FLATBUFFERS_COMPILER "${FLATBUFFERS_PREFIX}/bin/flatc")
|
||||
@@ -33,7 +35,7 @@ include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_DIR})
|
||||
|
||||
# Custom CFLAGS
|
||||
|
||||
set(CMAKE_C_FLAGS "-g -Wall -Wextra -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-type-limits -Wno-missing-field-initializers --std=c99 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -fPIC -std=c99")
|
||||
set(CMAKE_C_FLAGS "-g -Wall -Wextra -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-type-limits -Wno-missing-field-initializers --std=c99 -fPIC -std=c99")
|
||||
|
||||
# Code for finding Python
|
||||
find_package(PythonInterp REQUIRED)
|
||||
|
||||
@@ -388,6 +388,49 @@ bool PublishObjectNotification(RedisModuleCtx *ctx,
|
||||
return true;
|
||||
}
|
||||
|
||||
// This is a temporary redis command that will be removed once
|
||||
// the GCS uses https://github.com/pcmoritz/credis.
|
||||
int TableAdd_RedisCommand(RedisModuleCtx *ctx,
|
||||
RedisModuleString **argv,
|
||||
int argc) {
|
||||
if (argc != 3) {
|
||||
return RedisModule_WrongArity(ctx);
|
||||
}
|
||||
|
||||
RedisModuleString *id = argv[1];
|
||||
RedisModuleString *data = argv[2];
|
||||
|
||||
// Set the keys in the table
|
||||
RedisModuleKey *key =
|
||||
OpenPrefixedKey(ctx, "T:", id, REDISMODULE_READ | REDISMODULE_WRITE);
|
||||
RedisModule_StringSet(key, data);
|
||||
RedisModule_CloseKey(key);
|
||||
|
||||
return RedisModule_ReplyWithSimpleString(ctx, "OK");
|
||||
}
|
||||
|
||||
// This is a temporary redis command that will be removed once
|
||||
// the GCS uses https://github.com/pcmoritz/credis.
|
||||
int TableLookup_RedisCommand(RedisModuleCtx *ctx,
|
||||
RedisModuleString **argv,
|
||||
int argc) {
|
||||
if (argc != 2) {
|
||||
return RedisModule_WrongArity(ctx);
|
||||
}
|
||||
|
||||
RedisModuleString *id = argv[1];
|
||||
|
||||
RedisModuleKey *key = OpenPrefixedKey(ctx, "T:", id, REDISMODULE_READ);
|
||||
size_t len = 0;
|
||||
const char *buf = RedisModule_StringDMA(key, &len, REDISMODULE_READ);
|
||||
|
||||
RedisModule_ReplyWithStringBuffer(ctx, buf, len);
|
||||
|
||||
RedisModule_CloseKey(key);
|
||||
|
||||
return REDISMODULE_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new entry to the object table or update an existing one.
|
||||
*
|
||||
@@ -1149,6 +1192,17 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx,
|
||||
return REDISMODULE_ERR;
|
||||
}
|
||||
|
||||
if (RedisModule_CreateCommand(ctx, "ray.table_add", TableAdd_RedisCommand,
|
||||
"write", 0, 0, 0) == REDISMODULE_ERR) {
|
||||
return REDISMODULE_ERR;
|
||||
}
|
||||
|
||||
if (RedisModule_CreateCommand(ctx, "ray.table_lookup",
|
||||
TableLookup_RedisCommand, "readonly", 0, 0,
|
||||
0) == REDISMODULE_ERR) {
|
||||
return REDISMODULE_ERR;
|
||||
}
|
||||
|
||||
if (RedisModule_CreateCommand(ctx, "ray.object_table_lookup",
|
||||
ObjectTableLookup_RedisCommand, "readonly", 0,
|
||||
0, 0) == REDISMODULE_ERR) {
|
||||
|
||||
Reference in New Issue
Block a user