Package org.drasyl.handler.arq.gobackn
Interface Window
- All Known Implementing Classes:
SimpleWindow
public interface Window
This class does model a sliding window in the Go-Back-N ARQ protocol.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(GoBackNArqData msg, io.netty.channel.ChannelPromise promise) Adds the given msg to the window, if there is enough capacity.int
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 Details
-
add
Adds the given msg to the window, if there is enough capacity.- Parameters:
msg
- the message to addpromise
- the write promise- Returns:
true
, if the message could be added,false
if the window has no capacity
-
remove
io.netty.channel.ChannelPromise remove()Removes the oldest message from the window.- Returns:
- the write promise of the oldest message
-
getQueue
List<Window.Frame> getQueue()- Returns:
- the original unacknowledged message queue
-
size
int size()- Returns:
- the size of the window
-
getFreeSpace
int getFreeSpace()- Returns:
- the free space of the window
-
removeAndFailAll
Clears the window and let's fail all write promises.- Parameters:
cause
- the cause of the failure
-