本文整理汇总了C++中process::UPID方法的典型用法代码示例。如果您正苦于以下问题:C++ process::UPID方法的具体用法?C++ process::UPID怎么用?C++ process::UPID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类process
的用法示例。
在下文中一共展示了process::UPID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawn
TEST(ProcessTest, Remote)
{
ASSERT_TRUE(GTEST_IS_THREADSAFE);
RemoteProcess process;
spawn(process);
Future<Nothing> handler;
EXPECT_CALL(process, handler(_, _))
.WillOnce(FutureSatisfy(&handler));
Try<Socket> create = Socket::create();
ASSERT_SOME(create);
Socket socket = create.get();
AWAIT_READY(socket.connect(process.self().address));
Message message;
message.name = "handler";
message.from = UPID();
message.to = process.self();
const string data = MessageEncoder::encode(&message);
AWAIT_READY(socket.send(data));
AWAIT_READY(handler);
terminate(process);
wait(process);
}
示例2: TerminateEvent
TEST(ProcessTest, Event)
{
Event* event = new TerminateEvent(UPID());
EXPECT_FALSE(event->is<MessageEvent>());
EXPECT_FALSE(event->is<ExitedEvent>());
EXPECT_TRUE(event->is<TerminateEvent>());
delete event;
}
示例3: evolve
v1::scheduler::Event evolve(const StatusUpdateMessage& message)
{
v1::scheduler::Event event;
event.set_type(v1::scheduler::Event::UPDATE);
v1::scheduler::Event::Update* update = event.mutable_update();
update->mutable_status()->CopyFrom(evolve(message.update().status()));
if (message.update().has_slave_id()) {
update->mutable_status()->mutable_agent_id()->CopyFrom(
evolve(message.update().slave_id()));
}
if (message.update().has_executor_id()) {
update->mutable_status()->mutable_executor_id()->CopyFrom(
evolve(message.update().executor_id()));
}
update->mutable_status()->set_timestamp(message.update().timestamp());
// If the update does not have a 'uuid', it does not need
// acknowledging. However, prior to 0.23.0, the update uuid
// was required and always set. In 0.24.0, we can rely on the
// update uuid check here, until then we must still check for
// this being sent from the driver (from == UPID()) or from
// the master (pid == UPID()).
// TODO(vinod): Get rid of this logic in 0.25.0 because master
// and slave correctly set task status in 0.24.0.
if (!message.update().has_uuid() || message.update().uuid() == "") {
update->mutable_status()->clear_uuid();
} else if (UPID(message.pid()) == UPID()) {
update->mutable_status()->clear_uuid();
} else {
update->mutable_status()->set_uuid(message.update().uuid());
}
return event;
}