proxygen
FlowControlFilter.h
Go to the documentation of this file.
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  *
9  */
10 #pragma once
11 
14 
15 namespace folly {
16 class IOBufQueue;
17 }
18 
19 namespace proxygen {
20 
28  public:
29  class Callback {
30  public:
31  virtual ~Callback() {}
35  virtual void onConnectionSendWindowOpen() = 0;
36  virtual void onConnectionSendWindowClosed() = 0;
37  };
38 
51  explicit
52  FlowControlFilter(Callback& callback,
55  uint32_t recvCapacity = 0);
56 
65  void setReceiveWindowSize(folly::IOBufQueue& writeBuf, uint32_t capacity);
66 
76  bool ingressBytesProcessed(folly::IOBufQueue& writeBuf, uint32_t delta);
77 
81  uint32_t getAvailableSend() const;
82 
83  // Filter functions
84 
85  bool isReusable() const override;
86 
87  void onBody(StreamID stream, std::unique_ptr<folly::IOBuf> chain,
88  uint16_t padding) override;
89 
90  void onWindowUpdate(StreamID stream, uint32_t amount) override;
91 
92  size_t generateBody(folly::IOBufQueue& writeBuf,
93  StreamID stream,
94  std::unique_ptr<folly::IOBuf> chain,
96  bool eom) override;
97 
98  size_t generateWindowUpdate(folly::IOBufQueue& writeBuf,
99  StreamID stream,
100  uint32_t delta) override;
101 
102  private:
103 
107  int32_t toAck_{0};
108  bool error_:1;
109  bool sendsBlocked_:1;
110 };
111 
112 }
CodecFactory codec
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
void writeBuf(const Buf &buf, folly::io::Appender &out)