(wangle) deprecate Later and ThreadGate
authorHans Fugal <fugalh@fb.com>
Mon, 20 Oct 2014 19:11:19 +0000 (12:11 -0700)
committerdcsommer <dcsommer@fb.com>
Wed, 29 Oct 2014 23:02:54 +0000 (16:02 -0700)
Summary:
Later is now superfluous. Just hold a deactivated future (e.g. one returned by `Future::via`), and then activate (or destruct) it when you're ready.
ThreadGate has proven to be too rigid and too heavyweight to be really useful. And is superfluous now with `Future::via`. e.g.
f.via(east).then(a1).then(a2).via(west).then(b1).then(b2);

This is stage one of removing these: mark them deprecated.
Stage two will be for me to change all existing usages in our code to not use them.
Stage three will be to rip these out altogether.

Test Plan:
Everything still builds and works, but now with deprecation warnings.

fbconfig -r \
common/smc/cpp/tests \
folly/wangle \
langtech/audiens \
messaging/avscan \
messaging/maelstrom \
neteng/traffic_manager \
notifications/nudge/service \
tao/client \
zeus/datashuttle
fbmake runtests

Reviewed By: jsedgwick@fb.com

Subscribers: net-systems@, fugalh, exa, njormrod, folly-diffs@

FB internal diff: D1626412

Tasks: 5409538

folly/wangle/Deprecated.h [new file with mode: 0644]
folly/wangle/Later.h
folly/wangle/ThreadGate.h

diff --git a/folly/wangle/Deprecated.h b/folly/wangle/Deprecated.h
new file mode 100644 (file)
index 0000000..88d2f0f
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2014 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#define DEPRECATED __attribute__((deprecated))
index 94f2883c75d34a77a6e72427a0f5418f6eeb82f4..329748e1e7a82af9d3cbec88ca9f41ac063d6ceb 100644 (file)
@@ -16,6 +16,7 @@
 
 #pragma once
 
 
 #pragma once
 
+#include <folly/wangle/Deprecated.h>
 #include <folly/wangle/Executor.h>
 #include <folly/wangle/Future.h>
 #include <folly/Optional.h>
 #include <folly/wangle/Executor.h>
 #include <folly/wangle/Future.h>
 #include <folly/Optional.h>
@@ -76,8 +77,10 @@ template <typename T> struct isLater;
  *   .then([=]Try<DiskResponse>&& t) { return sendClientResponse(t.value()); })
  *   .launch();
  */
  *   .then([=]Try<DiskResponse>&& t) { return sendClientResponse(t.value()); })
  *   .launch();
  */
+// DEPRECATED. Just use Future::via() to accomplish the same thing. If it's
+// not obvious how, feel free to reach out.
 template <class T>
 template <class T>
-class Later {
+class DEPRECATED Later {
  public:
   typedef T value_type;
 
  public:
   typedef T value_type;
 
index bed9d9aa6a6259a4a89c2fb70931303695c2db06..597fa6ab7fe7a688d52277345db15b78e5128f6e 100644 (file)
@@ -17,6 +17,7 @@
 #pragma once
 #include <memory>
 #include <folly/wangle/Future.h>
 #pragma once
 #include <memory>
 #include <folly/wangle/Future.h>
+#include <folly/wangle/Deprecated.h>
 
 namespace folly { namespace wangle {
 
 
 namespace folly { namespace wangle {
 
@@ -73,7 +74,9 @@ namespace folly { namespace wangle {
   change the components of the ThreadGate which your client code is already
   using.
   */
   change the components of the ThreadGate which your client code is already
   using.
   */
-class ThreadGate {
+// DEPRECATED. Just use Future::via() to accomplish the same thing. If it's
+// not obvious how, feel free to reach out.
+class DEPRECATED ThreadGate {
 public:
   virtual ~ThreadGate() {}
 
 public:
   virtual ~ThreadGate() {}