enum OwnershipQosPolicyKind {
SHARED_OWNERSHIP_QOS,
EXCLUSIVE_OWNERSHIP_QOS
};
struct OwnershipQosPolicy {
OwnershipQosPolicyKind kind;
};
If the kind member is set to
SHARED_OWNERSHIP_QOS
, more than one Data Writer is allowed
to update the same data-object instance. If the kind member is set to
EXCLUSIVE_OWNERSHIP_QOS
, only one Data Writer is allowed to update a given data-object
instance (i.e., the Data Writer is considered to be the
owner
of the instance) and associated
Data Readers will only see samples written by that Data Writer. The owner of the instance is
determined by value of the
OWNERSHIP_STRENGTH
policy; the data writer with the highest
value of strength is considered the owner of the data-object instance. Other factors may also
influence ownership, such as whether the data writer with the highest strength is “alive” (as
defined by the
LIVELINESS
policy) and has not violated its offered publication deadline
constraints (as defined by the
DEADLINE
policy).
如果将kind成员设置为SHARED_OWNERSHIP_QOS,则允许多个Data Writer更新同一数据对象实例。 如果将kind成员设置为EXCLUSIVE_OWNERSHIP_QOS,则只允许一个Data Writer更新给定的数据对象实例(即,Data Writer被视为该实例的所有者),并且关联的Data Reader将仅看到由该数据Writer编写的示例。 实例的所有者由OWNERSHIP_STRENGTH策略的值确定; 具有最高强度值的数据写入器被视为数据对象实例的所有者。 其他因素也可能影响所有权,例如,具有最高强度的数据写入器是否“有效”(如LIVELINESS策略所定义)并且没有违反其提供的发布截止日期限制(如DEADLINE策略所定义)。
formal/2015-04-10:
This policy controls whether the Service allows multiple
DataWriter
objects to update the same instance (identified by
Topic
+
key
) of a data-object.
此策略控制服务是否允许多个DataWriter对象更新数据对象的同一实例(由Topic +键标识)。
There are two kinds of OWNERSHIP selected by the setting of the
kind
: SHARED and EXCLUSIVE.
通过该类型的设置可以选择两种所有权:共享和专有。
共享种类
This setting indicates that the Service does not enforce unique ownership for each instance. In this case, multiple writers can
update the same data-object instance. The subscriber to the
Topic
will be able to access modifications from all
DataWriter
objects, subject to the settings of other QoS that may filter particular samples (e.g., the TIME_BASED_FILTER or HISTORY
QoS policy). In any case there is no “filtering” of modifications made based on the identity of the
DataWriter
that causes the
modification.
此设置表明服务不会对每个实例强制执行唯一所有权。 在这种情况下,多个编写者可以更新同一数据对象实例。 主题的订阅者将能够访问所有DataWriter对象的修改,但要遵守可能过滤特定样本的其他QoS的设置(例如TIME_BASED_FILTER或HISTORY QoS策略)。 在任何情况下,都不会基于导致修改的DataWriter的身份对修改进行“过滤”。
专有种类
This setting indicates that each instance of a data-object can only be modified by one
DataWriter
. In other words, at any point
in time a single
DataWriter
“owns” each instance and is the only one whose modifications will be visible to the
DataReader
objects. The owner is determined by selecting the
DataWriter
with the highest value of the
strength
26
that is both “alive” as
defined by the LIVELINESS QoS policy and has not violated its DEADLINE contract with regards to the data-instance.
此设置表明一个数据对象的每个实例只能由一个DataWriter修改。 换句话说,在任何时间点,单个DataWriter都会“拥有”每个实例,并且是唯一一个其修改对DataReader对象可见的实例。 通过选择具有强度26最高值的DataWriter来确定所有者,强度26既是LIVELINESS QoS策略定义的“活动”,又在数据实例方面未违反其DEADLINE约定。
Ownership can therefore change as a result of (a) a
DataWriter
in the system with a higher value of the
strength
that modifies
the instance, (b) a change in the
strength
value of the
DataWriter
that owns the instance, (c) a change in the liveliness of the
DataWriter
that owns the instance, and (d) a deadline with regards to the instance that is missed by the DataWriter that owns
the instance.
因此,所有权可能会发生变化,因为(a)系统中的数据编写器具有更高的修改实例的强度值,(b)拥有该实例的数据编写器的强度值发生变化,(c)拥有该实例的数据编写器的活跃度发生变化,以及(d)关于实例的截止日期,该截止日期被拥有该实例的数据编写器错过。
The behavior of the system is as if the determination was made independently by each
DataReader
. Each
DataReader
may
detect the change of ownership at a different time. It is not a requirement that at a particular point in time all the
DataReader
objects for that
Topic
have a consistent picture of who owns each instance.
系统的行为就像确定是由每个DataReader独立进行的。 每个DataReader可能会在不同时间检测所有权的更改。 不需要在特定的时间点上该Topic的所有DataReader对象都具有谁拥有每个实例的一致图片。
It is also not a requirement that the
DataWriter
objects are aware of whether they own a particular instance. There is no error or
notification given to a
DataWriter
that modifies an instance it does not currently own.
也不要求DataWriter对象知道它们是否拥有特定实例。 没有错误或通知给DataWriter,它修改了它当前不拥有的实例。
The requirements are chosen to (a) preserve the decoupling of publishers and subscriber, and (b) allow the policy to be
implemented efficiently.
选择这些要求是为了(a)保持发布者和订阅者的分离,以及(b)允许有效地实施该策略。
It is possible that multiple
DataWriter
objects with the same strength modify the same instance. If this occurs the Service will
pick one of the
DataWriter
objects as the “owner.” It is not specified how the owner is selected. However, it is required that the
policy used to select the owner is such that all
DataReader
objects will make the same choice of the particular
DataWriter
that
is the owner. It is also required that the owner remains the same until there is a change in
strength
,
liveliness
, the owner isses
a
deadline
on the instance, a new
DataWriter
with higher
strength
modifies the instance, or another
DataWriter
with the same
strength that is deemed by the Service to be the new owner modifies the instance.
具有相同强度的多个DataWriter对象可能修改同一个实例。如果发生这种情况,服务将选择其中一个DataWriter对象作为“所有者”。它没有指定如何选择所有者。但是,要求用于选择所有者的策略是,所有DataReader对象将对作为所有者的特定DataWriter做出相同的选择。还要求所有者保持不变,直到强度、活跃度发生变化,所有者在实例上截止日期,具有更高强度的新数据编写器修改实例,或服务认为具有相同强度的另一个数据编写器修改实例。
Exclusive ownership is on an instance-by-instance basis. That is, a subscriber can receive values written by a lower
strength
DataWriter
as long as they affect instances whose values have not been set by the higher-strength
DataWriter
.
专有所有权是基于实例的。 即,订户可以接收由强度较低的DataWriter写入的值,只要它们影响其值尚未由强度较高的DataWriter设置的实例即可。
The value of the OWNERSHIP
kind
offered must exactly match the one requested or else they are considered
incompatible.
提供的OWNERSHIP类型的值必须与请求的值完全匹配,否则将被视为不兼容。
10.OWNERSHIP_STRENGTH
OpenDDS:
The
OWNERSHIP_STRENGTH
policy is used in conjunction with the
OWNERSHIP
policy, when the
OWNERSHIP kind
is set to
EXCLUSIVE
. Below is the IDL related to the Ownership Strength
QoS policy:
当OWNERSHIP类型设置为EXCLUSIVE时,OWNERSHIP_STRENGTH策略与OWNERSHIP策略结合使用。 以下是与所有权强度QoS策略相关的IDL:
struct OwnershipStrengthQosPolicy {
long value;
};
The value member is used to determine which Data Writer is the
owner
of the data-object
instance. The default value is zero.
值成员用于确定哪个Data Writer是数据对象实例的所有者。 默认值为零。
formal/2015-04-10:
This QoS policy should be used in combination with the OWNERSHIP policy. It only applies to the situation case where
OWNERSHIP
kind
is set to EXCLUSIVE.
此QoS策略应与OWNERSHIP策略一起使用。 它仅适用于将OWNERSHIP种类设置为EXCLUSIVE的情况。
The value of the OWNERSHIP_STRENGTH is used to determine the ownership of a data-instance (identified by the key).
The arbitration is performed by the
DataReader
. The rules used to perform the arbitration are described in 2.2.3.9.2,
EXCLUSIVE kind.
OWNERSHIP_STRENGTH的值用于确定数据实例的所有权(由密钥标识)。 仲裁由DataReader执行。 在2.2.3.9.2中,排他性描述了用于执行仲裁的规则。
用ChatGPT
《OpenDDS Developer's Guide》:
3.2.22 所有权
所有权(OWNERSHIP)策略控制是否允许多个数据写入者(Data Writer)为同一个数据对象实例(data-object instance)写入样本。所有权可以是独占的(EXCLUSIVE)或共享的(SHARED)。以下是与所有权服务质量(QoS)策略相关的IDL(接口描述语言)代码段:
enum OwnershipQosPolicyKind {
SHARED_OWNERSHIP_QOS,
EXCLUSIVE_OWNERSHIP_QOS
};
struct OwnershipQosPolicy {
OwnershipQosPolicyKind kind;
};
如果`kind`成员被设置为`SHARED_OWNERSHIP_QOS`,则允许多个数据写入者更新同一个数据对象实例。如果`kind`成员被设置为`EXCLUSIVE_OWNERSHIP_QOS`,则只允许一个数据写入者更新给定的数据对象实例(即,该数据写入者被认为是实例的所有者),相关的数据读取者(Data Reader)将只看到该数据写入者写入的样本。实例的所有者是根据所有权强度(OWNERSHIP_STRENGTH)策略的值来确定的;拥有最高强度值的数据写入者被认为是数据对象实例的所有者。其他因素也可能影响所有权,例如拥有最高强度的数据写入者是否“存活”(如LIVELINESS策略所定义),以及是否没有违反其提供的发布截止期限约束(如DEADLINE策略所定义)。
3.2.23 所有权强度
所有权强度(OWNERSHIP_STRENGTH)策略与所有权策略一起使用,当所有权的类型被设置为独占时。以下是与所有权强度服务质量(QoS)策略相关的IDL代码段:
struct OwnershipStrengthQosPolicy {
long value;
};
value成员用于确定哪个数据写入者是数据对象实例的所有者。默认值为零。
翻译及解释:
所有权策略用于控制是否允许多个数据写入者向同一数据对象实例写入数据。所有权可以是共享或独占的。若`kind`成员被设为`SHARED_OWNERSHIP_QOS`,意味着允许多个数据写入者更新同一数据对象实例。若`kind`设为`EXCLUSIVE_OWNERSHIP_QOS`,则仅允许一个数据写入者更新特定数据对象实例,该数据写入者被视为该实例的所有者,相关数据读取者将只能看到该数据写入者的样本。实例的所有者是基于所有权强度策略的值来确定,具有最高强度值的数据写入者被认为是该数据对象实例的所有者。除此之外,其他因素也可能影响所有权决定,如最高强度的数据写入者是否存活以及是否违反了公布的期限约束。
所有权强度策略与所有权策略一起使用,在所有权类型被设置为独占时。`value`成员用于决定哪个数据写入者拥有数据对象实例的所有权。默认的强度值为零。
《Data Distribution Service (DDS)》Version 1.4 :
这段文本讨论的是DDS(数据分发服务)标准中的OWNERSHIP质量服务(QoS)策略。OWNERSHIP策略控制是否允许多个DataWriter对象更新相同实例(由主题+键标识)的数据对象。在OWNERSHIP策略下,有两种模式可以选择:SHARED(共享)和EXCLUSIVE(独占)。
以下是对这段英文原文的中文翻译和讲解:
2.2.3.9 OWNERSHIP
这项策略控制服务是否允许多个DataWriter对象更新同一个数据对象实例(通过主题+键来识别)。
OWNERSHIP有两种类型,可以通过设置kind属性来选择:SHARED(共享)和EXCLUSIVE(独占)。
2.2.3.9.1 SHARED类型
这个设置指的是服务不强制对每个实例执行独特的所有权。在这种情况下,多个写入器可以更新同一数据对象实例。订阅该主题的读者将能够访问来自所有DataWriter对象的修改,这取决于可能过滤特定样本的其他QoS设置(例如,基于时间的过滤器或历史QoS策略)。无论如何,不会基于造成修改的DataWriter的身份来“过滤”修改。
2.2.3.9.2 EXCLUSIVE类型
此设置指出,每个数据对象实例只能由一个DataWriter修改。换言之,任何时候,单个DataWriter“拥有”每个实例,并且只有它的修改对于DataReader对象可见。所有者由选择剩活力(由LIVELINESS QoS策略定义)且没有违反其关于数据实例的DEADLINE合同的强度最高的DataWriter来确定。
所有权因此可以由于以下原因发生变化:(a)系统中具有更高强度值并修改了实例的DataWriter;(b)拥有该实例的DataWriter的强度值变化;(c)拥有该实例的DataWriter的生存状态变化;以及(d)拥有该实例的DataWriter错过了关于该实例的截止日期。
系统的行为就好像每个DataReader独立地做出决定一样。每个DataReader可能在不同的时间检测到所有权的变化。并不要求在特定时间点,所有该主题的DataReader对象都对谁拥有每个实例有一致的看法。
DataWriter对象也不需要意识到它们是否拥有特定实例。DataWriter在修改其当前不拥有的实例时,不会收到错误或通知。
这些要求是为了(a)保持发布者和订阅者的解耦, 以及(b)允许高效地实现该策略。
可能存在多个具有相同强度的DataWriter对象修改同一实例。如果发生这种情况,服务将选择其中一个DataWriter作为“所有者”。如何选择所有者没有给出规定。但是,要求选择所有者的策略能够使所有DataReader对象做出相同的选择,以确定特定的DataWriter作为所有者。同时,除非出现强度变化、活力变化,当前所有者错过了实例的截止日期,新的具有更高强度的DataWriter修改了实例,或另一个被服务认为是新所有者的相同强度DataWriter修改了实例,否则所有者应保持不变。
2.2.3.10 OWNERSHIP_STRENGTH
这个QoS策略应该与OWNERSHIP策略一起使用。它仅适用于OWNERSHIP类型设置为EXCLUSIVE的情况下。
OWNERSHIP_STRENGTH的值用于确定数据实例(通过键标识)的所有权。由DataReader执行仲裁。执行仲裁的规则在2.2.3.9.2节,即EXCLUSIVE类型中有描述。
独占所有权是基于实例逐个实施的。也就是说,订阅者可以接收由较低强度DataWriter写入的值,只要它们影响的实例没有被更高强度的DataWriter设置值。
所提供的OWNERSHIP种类的值必须与所请求的完全匹配,否则它们被认为是不兼容的。