CHAPTER 3Quality of Service.docx

上传人:b****8 文档编号:9947379 上传时间:2023-05-22 格式:DOCX 页数:35 大小:36.27KB
下载 相关 举报
CHAPTER 3Quality of Service.docx_第1页
第1页 / 共35页
CHAPTER 3Quality of Service.docx_第2页
第2页 / 共35页
CHAPTER 3Quality of Service.docx_第3页
第3页 / 共35页
CHAPTER 3Quality of Service.docx_第4页
第4页 / 共35页
CHAPTER 3Quality of Service.docx_第5页
第5页 / 共35页
CHAPTER 3Quality of Service.docx_第6页
第6页 / 共35页
CHAPTER 3Quality of Service.docx_第7页
第7页 / 共35页
CHAPTER 3Quality of Service.docx_第8页
第8页 / 共35页
CHAPTER 3Quality of Service.docx_第9页
第9页 / 共35页
CHAPTER 3Quality of Service.docx_第10页
第10页 / 共35页
CHAPTER 3Quality of Service.docx_第11页
第11页 / 共35页
CHAPTER 3Quality of Service.docx_第12页
第12页 / 共35页
CHAPTER 3Quality of Service.docx_第13页
第13页 / 共35页
CHAPTER 3Quality of Service.docx_第14页
第14页 / 共35页
CHAPTER 3Quality of Service.docx_第15页
第15页 / 共35页
CHAPTER 3Quality of Service.docx_第16页
第16页 / 共35页
CHAPTER 3Quality of Service.docx_第17页
第17页 / 共35页
CHAPTER 3Quality of Service.docx_第18页
第18页 / 共35页
CHAPTER 3Quality of Service.docx_第19页
第19页 / 共35页
CHAPTER 3Quality of Service.docx_第20页
第20页 / 共35页
亲,该文档总共35页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

CHAPTER 3Quality of Service.docx

《CHAPTER 3Quality of Service.docx》由会员分享,可在线阅读,更多相关《CHAPTER 3Quality of Service.docx(35页珍藏版)》请在冰点文库上搜索。

CHAPTER 3Quality of Service.docx

CHAPTER3QualityofService

CHAPTER3QualityofService

3.1Introduction

ThepreviousexamplesusedefaultQoSpoliciesforthevariousentities.ThischapterdiscussestheQoSpolicieswhichareimplementedinOpenDDSandthedetailsoftheirusage.SeetheDDSspecificationforfurtherinformationaboutthepoliciesdiscussedinthischapter.

前面的例子使用默认QoS策略的各种实体。

本章讨论的QoS策略中实现OpenDDS及其用法的详细信息。

看到进一步的DDS规范在本章讨论的政策信息。

3.2QoSPolicies

Eachpolicydefinesastructuretospecifyitsdata.EachentitysupportsasubsetofthepoliciesanddefinesaQoSstructurethatiscomposedofthesupportedpolicystructures.ThesetofallowablepoliciesforagivenentityisconstrainedbythepolicystructuresnestedinitsQoSstructure.Forexample,thePublisher’sQoSstructureisdefinedinthespecification’sIDLasfollows:

每个策略定义了一个指定其数据结构。

每个实体支持政策和定义了一个子集的QoS支持政策的结构,是由结构。

容许集政策对于一个给定的实体是制约其QoS策略结构嵌套结构。

例如,出版商的QoS结构规范的IDL定义如下:

moduleDDS{

structPublisherQos{

PresentationQosPolicypresentation;

PartitionQosPolicypartition;

GroupDataQosPolicygroup_data;

EntityFactoryQosPolicyentity_factory;

};

};

Settingpoliciesisassimpleasobtainingastructurewiththedefaultvaluesalreadyset,modifyingtheindividualpolicystructuresasnecessary,andthenapplyingtheQoSstructuretoanentity(usuallywhenitiscreated).WeshowexamplesofhowtoobtainthedefaultQoSpoliciesforvariousentitytypesin3.2.1.

设置策略非常简单,获得结构已经设置默认值,根据需要修改个人政策结构,然后应用QoS结构一个实体(通常创建时)。

我们展示的例子如何获得各种实体类型的默认QoS策略在3.2.1之上。

ApplicationscanchangetheQoSofanyentitybycallingtheset_qos()operationontheentity.IftheQoSischangeable,existingassociationsareremovediftheyarenolongercompatibleandnewassociationsareaddediftheybecomecompatible.TheDCPSInfoRepore-evaluatestheQoScompatibilityandassociationsaccordingtotheQoSspecification.Ifthecompatibilitycheckingfails,thecalltoset_qos()willreturnanerror.Theassociationre-evaluationmayresultinremovalofexistingassociationsoradditionofnewassociations.

应用程序可以通过调用set_qos改变任何实体的QoS()操作的实体。

如果QoS多变,删除现有的关联,如果他们不再兼容,添加新的联系,如果他们成为兼容。

的DCPSInfoRepo重新评估的QoS兼容性和协会根据QoS规范。

如果兼容性检查失败,调用set_qos()将返回一个错误。

协会重新评估可能导致取消现有的协会或添加新的联系

IftheuserattemptstochangeaQoSpolicythatisimmutable(notchangeable),thenset_qos()returnsDDS:

:

RETCODE_IMMUTABLE_POLICY.

如果用户试图改变QoS策略,是不变的(不是变化无常),然后set_qos()返回DDS:

:

RETCODE_IMMUTABLE_POLICY。

AsubsetoftheQoSpoliciesarechangeable.SomechangeableQoSpolicies,suchasUSER_DATA,TOPIC_DATA,GROUP_DATA,LIFESPAN,OWNERSHIP_STRENGTH,TIME_BASED_FILTER,ENTITY_FACTORY,WRITER_DATA_LIFECYCLE,andREADER_DATA_LIFECYCLE,donotrequirecompatibilityandassociationre-evaluation.TheDEADLINEandLATENCY_BUDGETQoSpoliciesrequirecompatibilityre-evaluation,butnotforassociation.ThePARTITIONQoSpolicydoesnotrequirecompatibilityre-evaluation,butdoesrequireassociationre-evaluation.TheDDSspecificationlistsTRANSPORT_PRIORITYaschangeable,buttheOpenDDSimplementationdoesnotsupportdynamicallymodifyingthispolicy.

一个子集QoS策略是多变的。

一些多变的QoS策略,比如USER_DATA,TOPIC_DATA,GROUP_DATA,寿命,OWNERSHIP_STRENGTH,TIME_BASED_FILTER,ENTITY_FACTORY,WRITER_DATA_LIFECYCLE,READER_DATA_LIFECYCLE,不需要兼容和协会进行重新评估。

最后期限和LATENCY_BUDGETQoS策略需要兼容性重新评估,但不是协会。

分区QoS策略不需要兼容性重新评估,但确实需要重新评估。

DDS规范列表TRANSPORT_PRIORITY多变,但OpenDDS实现不支持动态修改这一政策。

3.2.1DefaultQoSPolicyValues

ApplicationsobtainthedefaultQoSpoliciesforanentitybyinstantiatingaQoSstructureoftheappropriatetypefortheentityandpassingitbyreferencetotheappropriateget_default_entity_qos()operationontheappropriatefactoryentity.(Forexample,youwoulduseadomainparticipanttoobtainthedefaultQoSforapublisherorsubscriber.)Thefollowingexamplesillustratehowtoobtainthedefaultpoliciesforpublisher,subscriber,topic,domainparticipant,datawriter,anddatareader.

应用程序获得一个实体的默认QoS策略通过实例化一个QoS结构适当类型的实体,并通过引用适当的get_default_entity_qos()操作在适当的实体工厂。

(例如,您将使用一个域参与者获得出版商或用户的默认QoS)。

下面的示例说明如何获得出版商的默认策略,订阅者,主题,领域的参与者,数据作家,和数据阅读器。

//GetdefaultPublisherQoSfromaDomainParticipant:

DDS:

:

PublisherQospub_qos;

DDS:

:

ReturnCode_tret;

ret=domain_participant->get_default_publisher_qos(pub_qos);

if(DDS:

:

RETCODE_OK!

=ret){

std:

:

cerr<<"CouldnotgetdefaultpublisherQoS"<

:

endl;

}

//GetdefaultSubscriberQoSfromaDomainParticipant:

DDS:

:

SubscriberQossub_qos;

ret=domain_participant->get_default_subscriber_qos(sub_qos);

if(DDS:

:

RETCODE_OK!

=ret){

std:

:

cerr<<"CouldnotgetdefaultsubscriberQoS"<

:

endl;

}

//GetdefaultTopicQoSfromaDomainParticipant:

DDS:

:

TopicQostopic_qos;

ret=domain_participant->get_default_topic_qos(topic_qos);

if(DDS:

:

RETCODE_OK!

=ret){

std:

:

cerr<<"CouldnotgetdefaulttopicQoS"<

:

endl;

}

//GetdefaultDomainParticipantQoSfromaDomainParticipantFactory:

DDS:

:

DomainParticipantQosdp_qos;

ret=domain_participant_factory->get_default_participant_qos(dp_qos);

if(DDS:

:

RETCODE_OK!

=ret){

std:

:

cerr<<"CouldnotgetdefaultparticipantQoS"<

:

endl;

}

//GetdefaultDataWriterQoSfromaPublisher:

DDS:

:

DataWriterQosdw_qos;

ret=pub->get_default_datawriter_qos(dw_qos);

if(DDS:

:

RETCODE_OK!

=ret){

std:

:

cerr<<"CouldnotgetdefaultdatawriterQoS"<

:

endl;

}

//GetdefaultDataReaderQoSfromaSubscriber:

DDS:

:

DataReaderQosdr_qos;

ret=sub->get_default_datareader_qos(dr_qos);

if(DDS:

:

RETCODE_OK!

=ret){

std:

:

cerr<<"CouldnotgetdefaultdatareaderQoS"<

:

endl;

}

ThefollowingtablessummarizethedefaultQoSpoliciesforeachentitytypeinOpenDDStowhichpoliciescanbeapplied.

下表总结了每个实体类型的默认QoS策略可以应用在OpenDDS政策。

3.2.2LIVELINESS

TheLIVELINESSpolicyappliestothetopic,datareader,anddatawriterentitiesviathelivelinessmemberoftheirrespectiveQoSstructures.Settingthispolicyonatopicmeansitisineffectforalldatareadersanddatawritersonthattopic.BelowistheIDLrelatedtothelivelinessQoSpolicy:

活泼的政策适用于主题,读者数据,数据作家实体通过活泼的成员各自的QoS结构。

设置这个主题政策意味着它实际上是对所有数据读者和作家的话题。

下面是相关的IDL活泼QoS策略:

enumLivelinessQosPolicyKind{

AUTOMATIC_LIVELINESS_QOS,

MANUAL_BY_PARTICIPANT_LIVELINESS_QOS,

MANUAL_BY_TOPIC_LIVELINESS_QOS

};

structLivelinessQosPolicy{

LivelinessQosPolicyKindkind;

Duration_tlease_duration;

};

TheLIVELINESSpolicycontrolswhenandhowtheservicedetermineswhetherparticipantsarealive,meaningtheyarestillreachableandactive.Thekindmembersettingindicateswhetherlivelinessisassertedautomaticallybytheserviceormanuallybythespecifiedentity.AsettingofAUTOMATIC_LIVELINESS_QOSmeansthattheservicewillsendalivelinessindicationiftheparticipanthasnotsentanynetworktrafficforthelease_duration.TheMANUAL_BY_PARTICIPANT_LIVELINESS_QOSorMANUAL_BY_TOPIC_LIVELINESS_QOSsettingmeansthespecifiedentity(datawriterforthe“bytopic”settingordomainparticipantforthe“byparticipant”setting)musteitherwriteasampleormanuallyassertitslivelinesswithinaspecifiedheartbeatinterval.Thedesiredheartbeatintervalisspecifiedbythelease_durationmember.Thedefaultleasedurationisapre-definedinfinitevalue,whichdisablesanylivelinesstesting.

活泼的政策控制何时以及如何服务决定参与者是活着的,这意味着他们仍然可以和活跃。

这种成员设置指示是否活泼断言自动服务或手动指定的实体。

AUTOMATIC_LIVELINESS_QOS意味着服务的设置会发送一个活泼指示如果参与者没有发送任何lease_duration网络流量。

MANUAL_BY_PARTICIPANT_LIVELINESS_QOS或MANUAL_BY_TOPIC_LIVELINESS_QOS设置意味着指定的实体(数据作家“主题”设置或域参与者的“参与者”设置)必须手动编写一个样品或指定的心跳间隔内维护其活力。

所需的心跳间隔lease_duration指定的成员。

默认的租赁期限是一个预定义的无限价值,禁用任何活力测试。

Tomanuallyassertlivelinesswithoutpublishingasample,theapplicationmustcalltheassert_liveliness()operationonthedatawriter(forthe“bytopic”setting)oronthedomainparticipant(forthe“byparticipant”setting)withinthespecifiedheartbeatinterval.

手工维护活泼没有发布一个样本,应用程序必须调用assert_liveliness()操作数据的作家(“主题”设置)或域参与者(“参与者”设置)在指定的心跳间隔。

Datawritersspecify(offer)theirownlivelinesscriteriaanddatareadersspecify(request)thedesiredlivelinessoftheirwriters.Writersthatarenotheardfromwithintheleaseduration(eitherbywritingasampleorbyassertingliveliness)causeachangeintheLIVELINESS_CHANGED_STATUScommunicationstatusandnotificationtotheapplication(e.g.,bycallingthedatareaderlistener’son_liveliness_changed()callbackoperationorbysignalinganyrelatedwaitsets).

数据作者指定(提供)自己的活力标准和数据读者指定(请求)所需的活力的作家。

作家不听到租赁期限内(通过编写一个示例或通过断言活泼)导致LIVELINESS_CHANGED_STATUS通信现状和变化的通知应用程序(如。

通过调用数据读者听众的on_liveliness_changed()回调操作或暗示任何相关集)等

Thispolicyisconsideredduringtheestablishmentofassociationsbetweendatawritersanddatareaders.Thevalueofbothsidesoftheassociationmustbecompatibleinorderforanassociationtobeestablished.Compatibilityisdeterminedbycomparingthedatareader’srequestedlivelinesswiththedatawriter’sofferedliveliness.Boththekindofliveliness(automatic,manualbytopic,manualbyparticipant)andthevalueoftheleasedurationareconsideredindeterminingcompatibility.Thewriter’sofferedkindoflivelinessmustbegreaterthanorequaltothereader’srequestedkindofliveliness.Thelivelinesskindvaluesareorderedasfollows:

这一政策被认为是在数据作家和读者之间建立关联。

双方的价值协会必须兼容的一个协会。

兼容性是由比较数据请求读者的活泼与作家的活力。

活泼的类型(按主题自动、手动,手动参与者)和租赁时间的价值被认为是在确定兼容性。

作者提出一种活泼必须大于或等于读者的请求类型的活力。

活泼善良值命令如下:

MANUAL_BY_TOPIC_LIVELINESS_QOS>MANUAL_BY_PARTICIPANT_LIVELINESS_QOS>AUTOMATIC_LIVELINESS_QOS

Inaddition,thewriter’sofferedleasedurationmustbelessthanorequaltothereader’srequestedleaseduration.Bothoftheseconditionsmustbemetfortheofferedandrequestedlivelinesspolicysettingstobeconsideredcompatibleandtheassociationestablished.

此外,作者的提供租赁时间必须小于或等于读者的请求的租赁期限。

这两个条件必须满足

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2