当前位置: 首页>>代码示例>>PHP>>正文


PHP getCheckpoint函数代码示例

本文整理汇总了PHP中getCheckpoint函数的典型用法代码示例。如果您正苦于以下问题:PHP getCheckpoint函数的具体用法?PHP getCheckpoint怎么用?PHP getCheckpoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getCheckpoint函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set

 public function set($fieldName, $value)
 {
     // convert $value into something that can appear in our logs
     $convertor = new DataPrinter();
     $printable = $convertor->convertToString($value);
     // what are we doing?
     $log = usingLog()->startAction("set checkpoint field '{$fieldName}' to '{$printable}'");
     // get the checkpoint
     $checkpoint = getCheckpoint();
     // set the value
     $checkpoint->{$fieldName} = $value;
     // all done
     $log->endAction();
 }
开发者ID:datasift,项目名称:storyplayer,代码行数:14,代码来源:UsingCheckpoint.php

示例2: get

 public function get($fieldName)
 {
     // what are we doing?
     $log = usingLog()->startAction("get value of checkpoint field '{$fieldName}'");
     // get the checkpoint
     $checkpoint = getCheckpoint();
     // does the value exist?
     if (!isset($checkpoint->{$fieldName})) {
         throw new E5xx_ActionFailed(__METHOD__);
     }
     // all done
     $log->endAction();
     return $checkpoint->{$fieldName};
 }
开发者ID:datasift,项目名称:storyplayer,代码行数:14,代码来源:FromCheckpoint.php

示例3: getCheckpoint

//
// ------------------------------------------------------------------------
// ========================================================================
//
// POSSIBLE ACTION(S)
//
// ------------------------------------------------------------------------
$story->addAction(function () {
    // we're going to store the received message in here
    $checkpoint = getCheckpoint();
    foreach (firstHostWithRole("zmq_target") as $hostId) {
        $context = usingZmqContext()->getZmqContext();
        $inPort = fromHost($hostId)->getStorySetting("zmq.single.inPort");
        $outPort = fromHost($hostId)->getStorySetting("zmq.single.outPort");
        $inSocket = usingZmqContext($context)->connectToHost($hostId, $inPort, 'PUSH');
        $outSocket = usingZmqContext($context)->connectToHost($hostId, $outPort, 'PULL');
        usingZmqSocket($inSocket)->send($checkpoint->expectedMessage);
        $checkpoint->actualMessage = fromZmqSocket($outSocket)->recv();
    }
});
// ========================================================================
//
// POST-TEST INSPECTION
//
// ------------------------------------------------------------------------
$story->addPostTestInspection(function () {
    $checkpoint = getCheckpoint();
    assertsObject($checkpoint)->hasAttribute("expectedMessage");
    assertsObject($checkpoint)->hasAttribute("actualMessage");
    assertsString($checkpoint->actualMessage)->equals($checkpoint->expectedMessage);
});
开发者ID:datasift,项目名称:storyplayer,代码行数:31,代码来源:CanSendAndReceiveSingleZeromqMessageStory.php


注:本文中的getCheckpoint函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。