mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-27 01:18:56 +01:00
rpc: logging for bytestream listener
This commit is contained in:
parent
53b3a940ec
commit
feabf1abcd
@ -117,7 +117,7 @@ func doSink(c *cli.Context) (err error) {
|
||||
PullMapping: findMapping(conf.PullACLs),
|
||||
}
|
||||
|
||||
if err = rpc.ListenByteStreamRPC(sshByteStream, handler); err != nil {
|
||||
if err = rpc.ListenByteStreamRPC(sshByteStream, handler, sinkLogger); err != nil {
|
||||
//os.Exit(1)
|
||||
err = cli.NewExitError(err, 1)
|
||||
defaultLog.Printf("listenbytestreamerror: %#v\n", err)
|
||||
|
@ -27,12 +27,17 @@ type RPCHandler interface {
|
||||
HandleIncrementalTransferRequest(r IncrementalTransferRequest) (io.Reader, error)
|
||||
}
|
||||
|
||||
type Logger interface {
|
||||
Printf(format string, args ...interface{})
|
||||
}
|
||||
|
||||
const ByteStreamRPCProtocolVersion = 1
|
||||
|
||||
type ByteStreamRPC struct {
|
||||
conn io.ReadWriteCloser
|
||||
encoder *json.Encoder
|
||||
decoder *json.Decoder
|
||||
log Logger
|
||||
}
|
||||
|
||||
func ConnectByteStreamRPC(conn io.ReadWriteCloser) (RPCRequester, error) {
|
||||
@ -52,7 +57,7 @@ func ConnectByteStreamRPC(conn io.ReadWriteCloser) (RPCRequester, error) {
|
||||
return rpc, nil
|
||||
}
|
||||
|
||||
func ListenByteStreamRPC(conn io.ReadWriteCloser, handler RPCHandler) error {
|
||||
func ListenByteStreamRPC(conn io.ReadWriteCloser, handler RPCHandler, log Logger) error {
|
||||
|
||||
// A request consists of two subsequent JSON objects
|
||||
// Object 1: RequestHeader => contains type of Request Body
|
||||
|
Loading…
Reference in New Issue
Block a user