-
Notifications
You must be signed in to change notification settings - Fork 0
Sentinel-13: rpc comment thru #13
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
@@ -46,22 +46,25 @@ import ( | |||
"github.com/ReshiAdavan/Sentinel/gobWrapper" | |||
) | |||
|
|||
// reqMsg represents a request message in the RPC system. | |||
type reqMsg struct { |
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.
Consider using a more descriptive name for endname
. It's not immediately clear what endname
refers to.
args []byte | ||
replyCh chan replyMsg | ||
endname interface{} // Name of sending ClientEnd | ||
svcMeth string // e.g., "Raft.AppendEntries" |
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.
The comment for svcMeth
could be more descriptive. Consider explaining what svcMeth
is used for in the context of the RPC system.
replyCh chan replyMsg | ||
endname interface{} // Name of sending ClientEnd | ||
svcMeth string // e.g., "Raft.AppendEntries" | ||
argsType reflect.Type // Reflect type of the arguments |
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.
The comment for argsType
could be more descriptive. Consider explaining why the type of the arguments is important in the context of the RPC system.
endname interface{} // Name of sending ClientEnd | ||
svcMeth string // e.g., "Raft.AppendEntries" | ||
argsType reflect.Type // Reflect type of the arguments | ||
args []byte // Arguments of the RPC, encoded as bytes |
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.
The comment for args
could be more descriptive. Consider explaining why the arguments need to be encoded as bytes.
svcMeth string // e.g., "Raft.AppendEntries" | ||
argsType reflect.Type // Reflect type of the arguments | ||
args []byte // Arguments of the RPC, encoded as bytes | ||
replyCh chan replyMsg // Channel for receiving the reply |
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.
The comment for replyCh
could be more descriptive. Consider explaining why a channel is used for receiving the reply.
type replyMsg struct { | ||
ok bool | ||
reply []byte | ||
ok bool // True if the server executed the request |
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.
The comment for ok
could be more descriptive. Consider explaining what happens if the server does not execute the request.
ok bool | ||
reply []byte | ||
ok bool // True if the server executed the request | ||
reply []byte // Reply of the RPC, encoded as bytes |
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.
The comment for reply
could be more descriptive. Consider explaining why the reply needs to be encoded as bytes.
type ClientEnd struct { | ||
endname interface{} // this end-point's name | ||
ch chan reqMsg // copy of Network.endCh | ||
endname interface{} // This end-point's name |
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.
Consider using a more descriptive name for endname
. It's not immediately clear what endname
refers to.
endname interface{} // this end-point's name | ||
ch chan reqMsg // copy of Network.endCh | ||
endname interface{} // This end-point's name | ||
ch chan reqMsg // Channel to send requests |
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.
The comment for ch
could be more descriptive. Consider explaining why a channel is used to send requests.
@@ -96,6 +99,7 @@ func (e *ClientEnd) Call(svcMeth string, args interface{}, reply interface{}) bo | |||
} | |||
} | |||
|
|||
// Network simulates a network for RPC communication. |
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.
The comment // Network simulates a network for RPC communication.
is not very descriptive. Consider providing more details about the purpose and functionality of the Network
struct.
None