Implement push support.
Pushing is achieved by inverting the roles on the established connection, i.e. the client tells the server what data it should pull from the client (PullMeRequest). Role inversion is achieved by moving the server loop to the serverLoop function of ByteStreamRPC, which can be called from both the Listen() function (server-side) and the PullMeRequest() client-side function. A donwside of this PullMe approach is that the replication policies become part of the rpc, because the puller must follow the policy.
This commit is contained in:
+8
-1
@@ -12,7 +12,8 @@ const (
|
||||
RTFilesystemVersionsRequest = 0x11
|
||||
RTInitialTransferRequest = 0x12
|
||||
RTIncrementalTransferRequest = 0x13
|
||||
RTCloseRequest = 0x20
|
||||
RTPullMeRequest = 0x20
|
||||
RTCloseRequest = 0xf0
|
||||
)
|
||||
|
||||
type RequestHeader struct {
|
||||
@@ -62,6 +63,12 @@ const (
|
||||
InitialReplPolicyAll InitialReplPolicy = "all"
|
||||
)
|
||||
|
||||
type PullMeRequest struct {
|
||||
// if true, the other fields are undefined
|
||||
Finished bool
|
||||
InitialReplPolicy InitialReplPolicy
|
||||
}
|
||||
|
||||
type CloseRequest struct {
|
||||
Goodbye string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user