Package org.drasyl.handler.arq.gobackn
Class SimpleWindow
- java.lang.Object
-
- org.drasyl.handler.arq.gobackn.SimpleWindow
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.drasyl.handler.arq.gobackn.Window
Window.Frame
-
-
Constructor Summary
Constructors Constructor Description SimpleWindow(int capacity)
Creates a new simple window.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(GoBackNArqData msg, io.netty.channel.ChannelPromise promise)
Adds the given msg to the window, if there is enough capacity.int
getFreeSpace()
List<Window.Frame>
getQueue()
io.netty.channel.ChannelPromise
remove()
Removes the oldest message from the window.void
removeAndFailAll(Throwable cause)
Clears the window and let's fail all write promises.int
size()
-
-
-
Method Detail
-
add
public boolean add(GoBackNArqData msg, io.netty.channel.ChannelPromise promise)
Description copied from interface:Window
Adds the given msg to the window, if there is enough capacity.
-
remove
public io.netty.channel.ChannelPromise remove()
Description copied from interface:Window
Removes the oldest message from the window.
-
getQueue
public List<Window.Frame> getQueue()
-
getFreeSpace
public int getFreeSpace()
- Specified by:
getFreeSpace
in interfaceWindow
- Returns:
- the free space of the window
-
removeAndFailAll
public void removeAndFailAll(Throwable cause)
Description copied from interface:Window
Clears the window and let's fail all write promises.- Specified by:
removeAndFailAll
in interfaceWindow
- Parameters:
cause
- the cause of the failure
-
-