1 module hunt.http.codec.http.stream.StreamSPI; 2 3 import hunt.http.codec.http.stream.CloseState; 4 import hunt.http.codec.http.stream.Stream; 5 import hunt.http.codec.http.stream.SessionSPI; 6 7 import hunt.http.codec.http.frame.Frame; 8 import hunt.util.Common; 9 import hunt.util.Common; 10 11 12 /** 13 * <p>The SPI interface for implementing a HTTP/2 stream.</p> 14 * <p>This class :{@link Stream} by adding the methods required to 15 * implement the HTTP/2 stream functionalities.</p> 16 */ 17 interface StreamSPI : Stream , Closeable { // 18 19 /** 20 * @return whether this stream is local or remote 21 */ 22 bool isLocal(); 23 24 SessionSPI getSession(); 25 26 /** 27 * @return the {@link hunt.http.codec.http.stream.Stream.Listener} associated with this stream 28 * @see #setListener(Stream.Listener) 29 */ 30 Listener getListener(); 31 32 /** 33 * @param listener the {@link hunt.http.codec.http.stream.Stream.Listener} associated with this stream 34 * @see #getListener() 35 */ 36 void setListener(Listener listener); 37 38 /** 39 * <p>Processes the given {@code frame}, belonging to this stream.</p> 40 * 41 * @param frame the frame to process 42 * @param callback the callback to complete when frame has been processed 43 */ 44 void process(Frame frame, Callback callback); 45 46 /** 47 * <p>Updates the close state of this stream.</p> 48 * 49 * @param update whether to update the close state 50 * @param event the event that caused the close state update 51 * @return whether the stream has been fully closed by this invocation 52 */ 53 bool updateClose(bool update, CloseStateEvent event); 54 55 /** 56 * <p>Forcibly closes this stream.</p> 57 */ 58 void close(); 59 60 /** 61 * <p>Updates the stream send window by the given {@code delta}.</p> 62 * 63 * @param delta the delta value (positive or negative) to add to the stream send window 64 * @return the previous value of the stream send window 65 */ 66 int updateSendWindow(int delta); 67 68 /** 69 * <p>Updates the stream receive window by the given {@code delta}.</p> 70 * 71 * @param delta the delta value (positive or negative) to add to the stream receive window 72 * @return the previous value of the stream receive window 73 */ 74 int updateRecvWindow(int delta); 75 76 /** 77 * <p>Marks this stream as not idle so that the 78 * {@link #getIdleTimeout() idle timeout} is postponed.</p> 79 */ 80 // void notIdle(); 81 82 /** 83 * @return whether the stream is closed remotely. 84 * @see #isClosed() 85 */ 86 bool isRemotelyClosed(); 87 }