- Notifications
You must be signed in to change notification settings - Fork 44
add transport interface #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ||
import java.nio.ByteBuffer; | ||
| ||
public interface BufferHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MessageHandler
/** | ||
* This method is called before a iteration. | ||
*/ | ||
void startIteration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start() is ok, means start send
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start usually used to start a service, and called only once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startSession, finishSession
/** | ||
* Startup server, return the port listened. | ||
*/ | ||
int setup(Config config, BufferHandler handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to listen(), don't return int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A Transport4server need to listen on a port, there are multiple workers on a computer, need to listen on different port.
public interface BufferHandler { | ||
| ||
/** | ||
* Hand the buffer, it may block the caller a few seconds if it needs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't block netty handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can leads to OOM if the speed of data process is slower than the speed of data received. There is no good async at both sender and receiver.
* Startup server, return the port listened. | ||
*/ | ||
int setup(Config config, BufferHandler handler); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add pauseReceive() and resumeReceive()
if the pending_messages feature can control flow rate, we can delete ignore-resume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listen, set the port range in config.
* once. | ||
* @throws IOException if can't create connection. | ||
*/ | ||
void init(String hostname, int port) throws IOException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass config as parameter, client set config MAX_PENDING_REQUESTS in conifg
| ||
public static final ConfigOption<Integer> WORKER_DATA_PORT_RANGE_START = | ||
new ConfigOption<>( | ||
"worker.data_port_range_start", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data_port_start
public static final ConfigOption<Integer> WORKER_DATA_PORT_RANGE_START = | ||
new ConfigOption<>( | ||
"worker.data_port_range_start", | ||
"The start of range that the worker's data port listen on.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improve description, listen port not listen port range.
also explain that we will choose one from small to large of the range
Codecov Report
@@ Coverage Diff @@ ## master #20 +/- ## ============================================ + Coverage 80.82% 80.86% +0.04% Complexity 790 790 ============================================ Files 79 79 Lines 2602 2608 +6 Branches 236 236 ============================================ + Hits 2103 2109 +6 Misses 380 380 Partials 119 119
Continue to review full report at Codecov.
|
"worker.data_port_range_start", | ||
"The start of range that the worker's data port listen on.", | ||
"worker.data_port_start", | ||
"The start of range [WORKER_DATA_PORT_START, " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[data_port_start, data_port_end]
"WORKER_DATA_PORT_END]. The worker will choose one from " + | ||
"small to large of the range for data transportation.", | ||
"The start of range [data_port_start, data_port_end]. " + | ||
"The worker will choose one from small to large of the range" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrap line before "range"
| ||
/** | ||
* Startup server, return the port listened. The port range in config is | ||
* [{@link @ComputerOptions.WORKER_DATA_PORT_RANGE_START #STATIC_FIELD}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update it
| ||
/** | ||
* Init the connection from client to server. This method is called only | ||
* once. MAX_PENDING_REQUESTS is set in config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove redudant blank before 'is'
void init(Config config, String hostname, int port) throws IOException; | ||
| ||
/** | ||
* This method is called before a iteration of sending buffers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before a iteration
-> before an iteration
add lpa output (apache#20)
No description provided.