Skip to content

Commit 7f3dc2a

Browse files
committed
organize files in directories
Summary: organize files in directories Switched to <wdt/X.h> <wdt/util/Y.h> scheme from "X.h" "Y.h" Improved some include readability (adding empty line, added (c)) Shared the compiler flags : fixed unused variables and signed comparison mismatch warnings uncovered as a result Reduced some includes (still more to do) Reviewed By: nikunjy Differential Revision: D2569429 fb-gh-sync-id: 9cddc2072fc94fb11de34126089f2ba445ec0fb1
1 parent d56f647 commit 7f3dc2a

File tree

82 files changed

+1169
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1169
-186
lines changed

AbortChecker.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
19
#pragma once
210
#include <atomic>
11+
312
namespace facebook {
413
namespace wdt {
14+
515
/// Interface for external abort checks (pull mode)
616
class IAbortChecker {
717
public:
@@ -23,5 +33,6 @@ class WdtAbortChecker : public IAbortChecker {
2333
private:
2434
std::atomic<bool> const *abortTriggerPtr_;
2535
};
26-
}
36+
37+
} // end namespaces
2738
}

ByteSource.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99
#pragma once
1010

11-
#include "Reporting.h"
12-
#include "Protocol.h"
11+
#include <wdt/Reporting.h>
12+
#include <wdt/Protocol.h>
1313

1414
#include <string>
1515

@@ -114,5 +114,6 @@ class ByteSource {
114114
/// @param stats Stats to be added
115115
virtual void addTransferStats(const TransferStats &stats) = 0;
116116
};
117-
}
117+
118+
} // end namespaces
118119
}

CMakeLists.txt

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.2)
2222
# There is no C per se in WDT but if you use CXX only here many checks fail
2323
# Version is Major.Minor.YYMMDDX for up to 10 releases per day
2424
# Minor currently is also the protocol version - has to match with Protocol.cpp
25-
project("WDT" LANGUAGES C CXX VERSION 1.22.1510210)
25+
project("WDT" LANGUAGES C CXX VERSION 1.22.1510220)
2626

2727
# On MacOS this requires the latest (master) CMake (and/or CMake 3.1.1/3.2)
2828
set(CMAKE_CXX_STANDARD 11)
@@ -73,32 +73,32 @@ set (FOLLY_CPP_SRC
7373

7474
# WDT's library proper - comes from: ls -1 *.cpp | grep -iv test
7575
add_library(wdtlib_min
76-
ClientSocket.cpp
77-
DirectorySourceQueue.cpp
76+
util/ClientSocket.cpp
77+
util/DirectorySourceQueue.cpp
7878
ErrorCodes.cpp
79-
FileByteSource.cpp
80-
FileCreator.cpp
79+
util/FileByteSource.cpp
80+
util/FileCreator.cpp
8181
Protocol.cpp
8282
WdtThread.cpp
83-
ThreadsController.cpp
83+
util/ThreadsController.cpp
8484
ReceiverThread.cpp
8585
Receiver.cpp
8686
Reporting.cpp
87-
ThreadTransferHistory.cpp
87+
util/ThreadTransferHistory.cpp
8888
SenderThread.cpp
8989
Sender.cpp
90-
ServerSocket.cpp
91-
SocketUtils.cpp
90+
util/ServerSocket.cpp
91+
util/SocketUtils.cpp
9292
Throttler.cpp
9393
WdtOptions.cpp
94-
FileWriter.cpp
95-
TransferLogManager.cpp
96-
SerializationUtil.cpp
94+
util/FileWriter.cpp
95+
util/TransferLogManager.cpp
96+
util/SerializationUtil.cpp
9797
WdtBase.cpp
9898
WdtResourceController.cpp
9999
)
100100
add_library(wdtlib
101-
WdtFlags.cpp
101+
util/WdtFlags.cpp
102102
)
103103
target_link_libraries(wdtlib wdtlib_min)
104104

@@ -166,7 +166,7 @@ int main(int argc, char** argv) {
166166
}" FOLLY_HAVE_WEAK_SYMBOLS)
167167
# Now record all this :
168168
# Folly's:
169-
configure_file(folly-config.h.in folly/folly-config.h)
169+
configure_file(build/folly-config.h.in folly/folly-config.h)
170170
# Wdt's config/version
171171
configure_file(WdtConfig.h.in wdt/WdtConfig.h)
172172

@@ -189,8 +189,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
189189
include_directories(${FOLLY_SOURCE_DIR})
190190
include_directories(${GLOG_INCLUDE_DIR})
191191
include_directories(${GFLAGS_INCLUDE_DIR})
192+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
192193

193-
add_executable(wdt wdtCmdLine.cpp WdtFlags.cpp)
194+
add_executable(wdt wdtCmdLine.cpp util/WdtFlags.cpp)
194195
set_target_properties(wdt PROPERTIES COMPILE_DEFINITIONS "STANDALONE_APP")
195196

196197
target_link_libraries(wdt wdtlib_min)
@@ -203,7 +204,7 @@ install(TARGETS wdt wdtlib wdtlib_min folly4wdt
203204
ARCHIVE DESTINATION lib
204205
)
205206
# wcp script
206-
install(PROGRAMS wcp.sh DESTINATION bin RENAME wcp)
207+
install(PROGRAMS test/wcp.sh DESTINATION bin RENAME wcp)
207208

208209

209210
### Everything below is about testing (and not required to create wdt/wdtlib)
@@ -255,59 +256,60 @@ if (BUILD_TESTING)
255256
)
256257

257258
add_library(wdt4tests
258-
WdtFlags.cpp
259+
util/WdtFlags.cpp
259260
)
260261
target_link_libraries(wdt4tests wdt4tests_min)
261262

262263

263-
add_executable(protocol_test ProtocolTest.cpp)
264+
add_executable(protocol_test test/ProtocolTest.cpp)
264265
target_link_libraries(protocol_test wdt4tests)
265266
add_test(NAME AllTestsInProtocolTest COMMAND protocol_test)
266267

267-
add_executable(resource_controller_test WdtResourceControllerTest.cpp)
268+
add_executable(resource_controller_test test/WdtResourceControllerTest.cpp)
268269
target_link_libraries(resource_controller_test wdt4tests)
269270
add_test(NAME ResourceControllerTests COMMAND resource_controller_test)
270271

271-
add_executable(file_reader_test FileReaderTest.cpp)
272+
add_executable(file_reader_test test/FileReaderTest.cpp)
272273
target_link_libraries(file_reader_test wdt4tests)
273274
add_test(NAME FileReaderTests COMMAND file_reader_test)
274275

275-
add_executable(option_type_test_long_flags OptionTypeTest.cpp)
276+
add_executable(option_type_test_long_flags test/OptionTypeTest.cpp)
276277
target_link_libraries(option_type_test_long_flags wdt4tests)
277278

278-
add_executable(option_type_test_short_flags OptionTypeTest.cpp WdtFlags.cpp)
279+
add_executable(option_type_test_short_flags test/OptionTypeTest.cpp
280+
util/WdtFlags.cpp)
279281
set_target_properties(option_type_test_short_flags PROPERTIES
280282
COMPILE_DEFINITIONS "STANDALONE_APP")
281283
target_link_libraries(option_type_test_short_flags wdt4tests_min)
282284

283285
add_test(NAME WdtRandGenTest COMMAND
284-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_rand_gen_test.sh")
286+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_rand_gen_test.sh")
285287

286288
add_test(NAME WdtBasicE2E COMMAND
287-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_e2e_simple_test.sh")
289+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_e2e_simple_test.sh")
288290

289291
add_test(NAME WdtBasicE2Exfs COMMAND
290-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_e2e_xfs_test.sh")
292+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_e2e_xfs_test.sh")
291293

292294
add_test(NAME WdtOptionsTypeTests COMMAND
293-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_option_type_test.sh")
295+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_option_type_test.sh")
294296

295297
add_test(NAME WdtPortBlockTest COMMAND
296-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_port_block_test.py")
298+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_port_block_test.py")
297299

298300
add_test(NAME WdtProtocolNegotiationTest COMMAND
299-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_protocol_negotiation_test.py")
301+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_protocol_negotiation_test.py")
300302

301303
add_test(NAME WdtSimpleOdirectTest COMMAND
302-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_e2e_simple_test.sh" -o true)
304+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_e2e_simple_test.sh" -o true)
303305

304306
add_test(NAME WdtFileListTest COMMAND
305-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_file_list_test.py")
307+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_file_list_test.py")
306308

307309
add_test(NAME WdtOverwriteTest COMMAND
308-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_overwrite_test.py")
310+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_overwrite_test.py")
309311

310312
add_test(NAME WdtBadServerTest COMMAND
311-
"${CMAKE_CURRENT_SOURCE_DIR}/wdt_bad_server_test.py")
313+
"${CMAKE_CURRENT_SOURCE_DIR}/test/wdt_bad_server_test.py")
312314

313315
endif(BUILD_TESTING)

Protocol.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
9-
#include "Protocol.h"
9+
#include <wdt/Protocol.h>
1010

11-
#include "ErrorCodes.h"
12-
#include "WdtOptions.h"
13-
#include "SerializationUtil.h"
11+
#include <wdt/ErrorCodes.h>
12+
#include <wdt/WdtOptions.h>
13+
#include <wdt/util/SerializationUtil.h>
1414

1515
#include <folly/String.h> // exceptionStr
1616
#include <algorithm>

Protocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#pragma once
1010

11-
#include "ErrorCodes.h"
11+
#include <wdt/ErrorCodes.h>
1212

1313
#include <folly/Range.h>
1414
#include <stddef.h>

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,18 @@ needed.
9292

9393
### Directories
9494

95-
* deps/
96-
Dependencies (open source version)
95+
* top level
96+
Main WDT classes and Wdt command line source, CMakeLists.txt
97+
98+
* util/
99+
Utilities used for implementing the main objects
100+
101+
* test/
102+
Tests files and scripts
103+
104+
* build/
105+
Build related scripts and files and utils
106+
97107

98108
* fbonly/
99109
Stuff specific to facebook/ (not in open source version)
@@ -163,7 +173,7 @@ the current largest file)
163173
* ThreadTransferHistory.{h|cpp}
164174

165175
Every thread maintains a transfer history so that when a connection breaks
166-
it can talk to the receiver to find out up to where in the history has been
176+
it can talk to the receiver to find out up to where in the history has been
167177
sent. This class encapsulates all the logic for that bookkeeping
168178

169179
* SenderThread.{h|cpp}
@@ -288,15 +298,15 @@ wdt_max_send_test.sh
288298
(facebook only:)
289299
Make sure to do the following, before "arc diff":
290300
```
291-
(cd wdt ; ./clangformat.sh ; ./version_update.tcl )
301+
(cd wdt ; ./build/clangformat.sh ; ./build/version_update.tcl )
292302
293303
fbconfig --clang --with-project-version clang:dev -r wdt
294304
295305
fbmake runtests --run-disabled --extended-tests
296306
fbmake runtests_opt
297307
fbmake opt
298308
299-
wdt/wdt_max_send_test.sh
309+
wdt/test/wdt_max_send_test.sh
300310
```
301311

302312
and check the output of the last step to make sure one of the 3 runs is

Receiver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
9-
#include "Receiver.h"
10-
#include "ServerSocket.h"
11-
#include "FileWriter.h"
12-
#include "SocketUtils.h"
9+
#include <wdt/Receiver.h>
10+
#include <wdt/util/FileWriter.h>
11+
#include <wdt/util/ServerSocket.h>
12+
#include <wdt/util/SocketUtils.h>
1313

1414
#include <folly/Conv.h>
1515
#include <folly/Memory.h>

Receiver.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@
88
*/
99
#pragma once
1010

11-
#include "WdtBase.h"
12-
#include "FileCreator.h"
13-
#include "ErrorCodes.h"
14-
#include "WdtOptions.h"
15-
#include "Reporting.h"
16-
#include "ServerSocket.h"
17-
#include "Protocol.h"
18-
#include "Writer.h"
19-
#include "Throttler.h"
20-
#include "ReceiverThread.h"
21-
#include "TransferLogManager.h"
22-
#include "ThreadsController.h"
11+
#include <wdt/WdtBase.h>
12+
#include <wdt/ReceiverThread.h>
13+
#include <wdt/util/FileCreator.h>
14+
#include <wdt/util/ServerSocket.h>
15+
#include <wdt/util/TransferLogManager.h>
2316
#include <memory>
2417
#include <string>
2518
#include <condition_variable>

ReceiverThread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
9-
#include "ReceiverThread.h"
10-
#include "FileWriter.h"
9+
#include <wdt/ReceiverThread.h>
10+
#include <wdt/util/FileWriter.h>
1111
#include <folly/Conv.h>
1212
#include <folly/Memory.h>
1313
#include <folly/String.h>

ReceiverThread.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99
#pragma once
10-
#include "WdtBase.h"
11-
#include "WdtThread.h"
12-
#include "Receiver.h"
13-
#include "ServerSocket.h"
10+
#include <wdt/WdtBase.h>
11+
#include <wdt/WdtThread.h>
12+
#include <wdt/Receiver.h>
13+
#include <wdt/util/ServerSocket.h>
14+
1415
namespace facebook {
1516
namespace wdt {
17+
1618
class Receiver;
1719
/**
1820
* Wdt receiver has logic to maintain the consistency of the

0 commit comments

Comments
 (0)