add open/close to debora, barak bug fix

This commit is contained in:
Jae Kwon
2015-05-21 17:13:23 -07:00
parent c297f41a9f
commit 5029d53474
5 changed files with 118 additions and 31 deletions

View File

@ -18,6 +18,7 @@ import (
// When multiple are involved, the workflow is different.
// (First the command(s) are signed by all validators,
// and then it is broadcast).
// TODO: Implement a reasonable workflow with multiple validators.
func StartProcess(privKey acm.PrivKey, remote string, command btypes.CommandStartProcess) (response btypes.ResponseStartProcess, err error) {
nonce, err := GetNonce(remote)
@ -49,6 +50,26 @@ func ListProcesses(privKey acm.PrivKey, remote string, command btypes.CommandLis
return response, err
}
func OpenListener(privKey acm.PrivKey, remote string, command btypes.CommandOpenListener) (response btypes.ResponseOpenListener, err error) {
nonce, err := GetNonce(remote)
if err != nil {
return response, err
}
commandBytes, signature := SignCommand(privKey, nonce+1, command)
_, err = RunAuthCommand(remote, commandBytes, []acm.Signature{signature}, &response)
return response, err
}
func CloseListener(privKey acm.PrivKey, remote string, command btypes.CommandCloseListener) (response btypes.ResponseCloseListener, err error) {
nonce, err := GetNonce(remote)
if err != nil {
return response, err
}
commandBytes, signature := SignCommand(privKey, nonce+1, command)
_, err = RunAuthCommand(remote, commandBytes, []acm.Signature{signature}, &response)
return response, err
}
func DownloadFile(privKey acm.PrivKey, remote string, command btypes.CommandServeFile, outPath string) (n int64, err error) {
// Create authCommandJSONBytes
nonce, err := GetNonce(remote)