Skip to content

Commit

Permalink
Introducing HostWithShard-fwd.h (#403)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/mcrouter#403

Pull Request resolved: #9336

This will help to avoid full mcrouter_sr_deps.h include in some headers.

Differential Revision: D43301867

fbshipit-source-id: a734f1e2c280ba74186e3ceb61cfcc7dd838e052
  • Loading branch information
antonl2 authored and facebook-github-bot committed Feb 17, 2023
1 parent c31a703 commit 256d173
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
12 changes: 11 additions & 1 deletion third-party/mcrouter/mcrouter-CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ add_custom_command(
"${CMAKE_CURRENT_BINARY_DIR}/mcrouter/mcrouter_sr_deps.h"
COMMENT "Creating mcrouter_sr_deps.h symlink"
)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/mcrouter/HostWithShard-fwd.h"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/mcrouter/HostWithShard-fwd-impl.h"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/mcrouter"
COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_CURRENT_SOURCE_DIR}/mcrouter/HostWithShard-fwd-impl.h"
"${CMAKE_CURRENT_BINARY_DIR}/mcrouter/HostWithShard-fwd.h"
COMMENT "Creating HostWithShard-fwd.h symlink"
)
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/mcrouter/RouterRegistry.h")
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/mcrouter/ThriftAcceptor.h")
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/mcrouter/mcrouter_sr_deps.h")
list(APPEND CXX_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/mcrouter/HostWithShard-fwd.h")
list(APPEND CXX_SOURCES ${files})

add_definitions(-DNO_LIB_GFLAGS)
Expand Down Expand Up @@ -100,4 +110,4 @@ target_include_directories(mcrouter PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" "${JEMA
install(
TARGETS mcrouter
LIBRARY ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
)
)
1 change: 1 addition & 0 deletions third-party/mcrouter/src/mcrouter/CarbonRouterClient-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "mcrouter/CarbonRouterInstance.h"
#include "mcrouter/ForEachPossibleClient.h"
#include "mcrouter/HostWithShard-fwd.h"
#include "mcrouter/McrouterFiberContext.h"
#include "mcrouter/ProxyRequestContextTyped.h"
#include "mcrouter/lib/RouteHandleTraverser.h"
Expand Down
21 changes: 21 additions & 0 deletions third-party/mcrouter/src/mcrouter/HostWithShard-fwd-impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#pragma once

#include <cstdint>
#include <memory>

namespace facebook {
namespace memcache {

class HostInfo;
using HostInfoPtr = std::shared_ptr<HostInfo>;
using HostWithShard = std::pair<HostInfoPtr, int64_t>;

} // namespace memcache
} // namespace facebook
1 change: 1 addition & 0 deletions third-party/mcrouter/src/mcrouter/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ AC_CONFIG_LINKS([test/config.py:test/mcrouter_config.py])
AC_CONFIG_LINKS([RouterRegistry.h:RouterRegistry-impl.h])
AC_CONFIG_LINKS([ThriftAcceptor.h:ThriftAcceptor-impl.h])
AC_CONFIG_LINKS([mcrouter_sr_deps.h:mcrouter_sr_deps-impl.h])
AC_CONFIG_LINKS([HostWithShard-fwd.h:HostWithShard-fwd-impl.h])
AC_CONFIG_AUX_DIR([build-aux])

AM_INIT_AUTOMAKE([1.14 foreign dist-bzip2 nostdinc subdir-objects parallel-tests])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <memory>
#include <vector>

#include "mcrouter/HostWithShard-fwd.h"
#include "mcrouter/McrouterFiberContext.h"
#include "mcrouter/lib/PoolContext.h"
#include "mcrouter/lib/network/AccessPoint.h"
Expand Down

0 comments on commit 256d173

Please sign in to comment.