diff --git a/livesupport/src/modules/storageServer/var/GreenBox.php b/livesupport/src/modules/storageServer/var/GreenBox.php index f796ced81..ff4208b24 100644 --- a/livesupport/src/modules/storageServer/var/GreenBox.php +++ b/livesupport/src/modules/storageServer/var/GreenBox.php @@ -1160,6 +1160,23 @@ class GreenBox extends BasicStor{ return $tr->turnOnOffTransports($onOff); } + /** + * Pause, resume or cancel transport + * + * @param trtok: string - transport token + * @param action: string - pause | resume | cancel + * @return string - resulting transport state + */ + function doTransportAction($trtok, $action) { + // DUMMY + return 'pending'; + /* + require_once"Transport.php"; + $tr =& new Transport($this); + return $tr->setTransportRState($action); + */ + } + /* ------------------------ methods for ls-archive-format file transports */ /** * Open async file transfer from local storageServer to network hub, diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php index 1c04eade9..224f03380 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php @@ -2609,6 +2609,60 @@ class XR_LocStor extends LocStor{ return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res))); } + /** + * Pause, resume or cancel transport + * + * The XML-RPC name of this method is "locstor.doTransportAction". + * + * The input parameters are an XML-RPC struct with the following + * fields: + * + * + * On success, returns a XML-RPC struct with the following fields: + * + * + * On errors, returns an XML-RPC error response. + * The possible error codes and error message are: + * + * + * @param input XMLRPC struct + * @return XMLRPC struct + * @see Transport::doTransportAction + */ + function xr_doTransportAction($input) { + list($ok, $r) = $this->_xr_getPars($input); + if(!$ok) return $r; + // DUMMY + $res = 'pending'; + /* + require_once '../Transport.php'; + $tr =& new Transport($this); + $res = $tr->doTransportAction($r['trtok'], $r['action']); + */ + if(PEAR::isError($res)){ + $ec0 = intval($res->getCode()); + $ec = ($ec0 == GBERR_SESS || $ec0 == TRERR_TOK ? 800+$ec0 : 805 ); + return new XML_RPC_Response(0, $ec, + "xr_doTransportAction: ".$res->getMessage()." ".$res->getUserInfo() + ); + } + return new XML_RPC_Response(XML_RPC_encode(array('state'=>$res))); + } + /* ------------------------ methods for ls-archive-format file transports */ /** * Open async file transfer from local storageServer to network hub, diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php b/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php index be273340b..dd296ef17 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/xrLocStor.php @@ -159,6 +159,7 @@ $methods = array( 'getTransportInfo' => 'Common "check" method for transports', 'turnOnOffTransports' => 'Turn transports on/off, optionaly return current state', + 'doTransportAction' => 'Pause, resume or cancel transport', 'uploadFile2Hub' => 'Open async file transfer from local storageServer to network hub', 'getHubInitiatedTransfers' => 'Get list of prepared transfers initiated by hub', 'startHubInitiatedTransfer' => 'Start of download initiated by hub', diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/xr_cli_test.php b/livesupport/src/modules/storageServer/var/xmlrpc/xr_cli_test.php index 74f7eec72..3146d3862 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/xr_cli_test.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/xr_cli_test.php @@ -187,6 +187,8 @@ $infos = array( 'r'=>array('state', 'realsize', 'expectedsize', 'realchsum', 'expectedchsum')), "turnOnOffTransports" => array('m'=>"locstor.turnOnOffTransports", 'p'=>array('sessid', 'onOff'), 'r'=>array('state')), + "doTransportAction" => array('m'=>"locstor.doTransportAction", + 'p'=>array('sessid', 'trtok', 'action'), 'r'=>array('state')), "uploadFile2Hub" => array('m'=>"locstor.uploadFile2Hub", 'p'=>array('sessid', 'filePath'), 'r'=>array('trtok')), "getHubInitiatedTransfers" => array('m'=>"locstor.getHubInitiatedTransfers",