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:
Christian Schwarz
2017-05-16 16:57:24 +02:00
parent c7161cf8e6
commit 35dcfc234e
6 changed files with 200 additions and 29 deletions
+8 -1
View File
@@ -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
}