template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+typename std::enable_if<!std::is_same<T, Unit>::value>::type
Pipeline<R, W>::read(R msg) {
if (!front_) {
throw std::invalid_argument("read(): no inbound handler in Pipeline");
template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+typename std::enable_if<!std::is_same<T, Unit>::value>::type
Pipeline<R, W>::readEOF() {
if (!front_) {
throw std::invalid_argument("readEOF(): no inbound handler in Pipeline");
template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+typename std::enable_if<!std::is_same<T, Unit>::value>::type
Pipeline<R, W>::transportActive() {
if (front_) {
front_->transportActive();
template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+typename std::enable_if<!std::is_same<T, Unit>::value>::type
Pipeline<R, W>::transportInactive() {
if (front_) {
front_->transportInactive();
template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+typename std::enable_if<!std::is_same<T, Unit>::value>::type
Pipeline<R, W>::readException(exception_wrapper e) {
if (!front_) {
throw std::invalid_argument(
template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value, Future<void>>::type
+typename std::enable_if<!std::is_same<T, Unit>::value, Future<void>>::type
Pipeline<R, W>::write(W msg) {
if (!back_) {
throw std::invalid_argument("write(): no outbound handler in Pipeline");
template <class R, class W>
template <class T>
-typename std::enable_if<!std::is_same<T, Nothing>::value, Future<void>>::type
+typename std::enable_if<!std::is_same<T, Unit>::value, Future<void>>::type
Pipeline<R, W>::close() {
if (!back_) {
throw std::invalid_argument("close(): no outbound handler in Pipeline");
namespace detail {
template <class T>
-inline void logWarningIfNotNothing(const std::string& warning) {
+inline void logWarningIfNotUnit(const std::string& warning) {
LOG(WARNING) << warning;
}
template <>
-inline void logWarningIfNotNothing<Nothing>(const std::string& warning) {
+inline void logWarningIfNotUnit<Unit>(const std::string& warning) {
// do nothing
}
}
if (!front_) {
- detail::logWarningIfNotNothing<R>(
+ detail::logWarningIfNotUnit<R>(
"No inbound handler in Pipeline, inbound operations will throw "
"std::invalid_argument");
}
if (!back_) {
- detail::logWarningIfNotNothing<W>(
+ detail::logWarningIfNotUnit<W>(
"No outbound handler in Pipeline, outbound operations will throw "
"std::invalid_argument");
}
#include <folly/wangle/channel/HandlerContext.h>
#include <folly/futures/Future.h>
+#include <folly/futures/Unit.h>
#include <folly/io/async/AsyncTransport.h>
#include <folly/io/async/DelayedDestruction.h>
#include <folly/ExceptionWrapper.h>
std::shared_ptr<AsyncTransport> transport_;
};
-struct Nothing{};
-
/*
* R is the inbound type, i.e. inbound calls start with pipeline.read(R)
* W is the outbound type, i.e. outbound calls start with pipeline.write(W)
*
- * Use Nothing for one of the types if your pipeline is unidirectional.
- * If R is Nothing, read(), readEOF(), and readException() will be disabled.
- * If W is Nothing, write() and close() will be disabled.
+ * Use Unit for one of the types if your pipeline is unidirectional.
+ * If R is Unit, read(), readEOF(), and readException() will be disabled.
+ * If W is Unit, write() and close() will be disabled.
*/
-template <class R, class W = Nothing>
+template <class R, class W = Unit>
class Pipeline : public PipelineBase {
public:
Pipeline();
std::pair<uint64_t, uint64_t> getReadBufferSettings();
template <class T = R>
- typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value>::type
read(R msg);
template <class T = R>
- typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value>::type
readEOF();
template <class T = R>
- typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value>::type
readException(exception_wrapper e);
template <class T = R>
- typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value>::type
transportActive();
template <class T = R>
- typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value>::type
transportInactive();
template <class T = W>
- typename std::enable_if<!std::is_same<T, Nothing>::value, Future<void>>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value, Future<void>>::type
write(W msg);
template <class T = W>
- typename std::enable_if<!std::is_same<T, Nothing>::value, Future<void>>::type
+ typename std::enable_if<!std::is_same<T, Unit>::value, Future<void>>::type
close();
template <class H>