Package org.drasyl.handler.arq.gobackn
Class SimpleWindow
java.lang.Object
org.drasyl.handler.arq.gobackn.SimpleWindow
- All Implemented Interfaces:
Window
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.drasyl.handler.arq.gobackn.Window
Window.Frame -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(GoBackNArqData msg, io.netty.channel.ChannelPromise promise) Adds the given msg to the window, if there is enough capacity.intgetQueue()io.netty.channel.ChannelPromiseremove()Removes the oldest message from the window.voidremoveAndFailAll(Throwable cause) Clears the window and let's fail all write promises.intsize()
-
Constructor Details
-
SimpleWindow
public SimpleWindow(int capacity) Creates a new simple window.- Parameters:
capacity- the window size/capacity
-
-
Method Details
-
add
Description copied from interface:WindowAdds the given msg to the window, if there is enough capacity. -
remove
public io.netty.channel.ChannelPromise remove()Description copied from interface:WindowRemoves the oldest message from the window. -
getQueue
-
size
public int size() -
getFreeSpace
public int getFreeSpace()- Specified by:
getFreeSpacein interfaceWindow- Returns:
- the free space of the window
-
removeAndFailAll
Description copied from interface:WindowClears the window and let's fail all write promises.- Specified by:
removeAndFailAllin interfaceWindow- Parameters:
cause- the cause of the failure
-