https://download.csdn.net/download/eidolon_foot/12568768
16. LIFESPAN
OpenDDS Developer's Guide(OpenDDS Version 3.14)
The
LIFESPAN
QoS policy allows the application to specify when a sample expires. Expired
samples will not be delivered to subscribers. This policy applies to the topic and data writer
entities via the lifespan member of their respective QoS structures. Below is the IDL related
to the lifespan QoS policy.
LIFESPAN QoS策略允许应用程序指定样本何时过期。 过期的样本将不会交付给订户。 此策略通过其各自QoS结构的
lifespan成员适用于主题和数据编写者实体。 以下是与寿命QoS策略相关的IDL。
struct LifespanQosPolicy {
Duration_t duration;
}
The default value of the
duration
member is infinite, which means samples never expire.
OpenDDS currently supports expired sample detection on the publisher side when using a
DURABILITY kind
other than
VOLATILE
. The current OpenDDS implementation may not
remove samples from the data writer and data reader caches when they expire after being
placed in the cache.
持续时间成员的默认值是无限的,这意味着样本永不过期。 当使用除VOLATILE以外的DURABILITY类型时,OpenDDS当前支持发布者端的过期样本检测。 当前的OpenDDS实现可能在将样本放入缓存后过期后,无法从数据写入器和数据读取器缓存中删除它们。
The value of this policy may be changed at any time. Changes to this policy affect only data
written after the change.
该政策的值可以随时更改。 对此策略的更改仅影响更改后写入的数据。
Data Distribution Service Version 1.4( formal/2015-04-10)
The purpose of this QoS is to avoid delivering “stale” data to the application.
此QoS的目的是避免将“陈旧的”数据传递给应用程序。
Each data sample written by the
DataWriter
has an associated ‘expiration time’ beyond which the data should not be delivered
to any application. Once the sample expires, the data will be removed from the
DataReader
caches as well as from the
transient and persistent information caches.
DataWriter编写的每个数据样本都有一个关联的“过期时间”,超过该时间不应将数据传递给任何应用程序。 一旦样本过期,数据将从DataReader缓存以及瞬态和持久信息缓存中删除。
The ‘expiration time’ of each sample is computed by adding the duration specified by the LIFESPAN QoS to the
source
timestamp
. As described in 2.2.2.4.2.11 and 2.2.2.4.2.12 the
source timestamp
is either automatically computed by the Service
each time the
DataWriter write
operation is called, or else supplied by the application by means of the
write_w_timestamp
operation.
每个样本的“到期时间”是通过将LIFESPAN QoS指定的持续时间添加到源时间戳中来计算的。 如2.2.2.4.2.11和2.2.2.4.2.12所述,每次服务调用DataWriter写操作时,源时间戳都会由Service自动计算,或者由应用程序通过write_w_timestamp操作提供。
This QoS relies on the sender and receiving applications having their clocks sufficiently synchronized. If this is not the case
and the Service can detect it, the
DataReader
is allowed to use the reception timestamp instead of the source timestamp in its
computation of the ‘expiration time.’
此QoS依赖于其时钟充分同步的发送方和接收方应用程序。 如果不是这种情况,并且服务可以检测到它,则允许DataReader在计算“过期时间”时使用接收时间戳,而不是源时间戳。
用ChatGPT
《OpenDDS Developer's Guide》:
3.2.10 寿命(LIFESPAN)
寿命(LIFESPAN)QoS策略允许应用程序指定样本何时过期。过期的样本不会被分发给订阅者。这个策略适用于主题和数据写入实体,通过它们各自的QoS结构中的lifespan成员实现。下面是与lifespan QoS策略相关的IDL代码。
struct LifespanQosPolicy {
Duration_t duration;
}
duration成员的默认值是无限的,这表示样本永远不会过期。当前,OpenDDS在使用非VOLATILE(非易失性)持久性种类时,支持在发布者端检测过期样本。目前,OpenDDS的实现可能不会在样本过期后,从数据写入和数据读取缓存中移除它们。
这个策略的值随时都可能改变。对这个策略的更改只影响更改后写入的数据。
**中文翻译及讲解:**
寿命(LIFESPAN)QoS策略允许应用程序设置数据样本的有效期限。当样本超出这个期限时,它会过期并且不会被送达给订阅者。这个策略通过在其各自QoS设置中包含的寿命(lifespan)成员,适用于主题和数据写入者(DataWriter)实体。
这里提到的 Duration_t 结构定义了数据样本的持续时间。如果设置为默认值(无限),则表示数据样本没有过期时间,会一直保持有效。
当前版本的OpenDDS(版本3.14)支持在发布者这一端检测过期的样本。这在使用的持续性(DURABILITY)类型不是VOLATILE(易失)时是有效的。不过,根据当前的OpenDDS实现,即使样本在放入缓存之后过期,可能也不会从数据写入者(DataWriter)和数据读取者(DataReader)的缓存中移除这些样本。
寿命(LIFESPAN)策略的值可以随时更改。任何对此策略的更改仅会影响更改后写入的数据,而不会影响更改前已经写入的数据。
《Data Distribution Service (DDS)》Version 1.4 :
2.2.3.16 生命周期(LIFESPAN)
这个QoS策略的目的是为了避免将“陈旧”的数据传递给应用程序。
数据写入者(DataWriter)写入的每个数据样本都有一个关联的“过期时间”,超过这个时间节点数据就不应该被传递给任何应用程序。一旦样本过期,数据将从数据读取者(DataReader)缓存中移除,同时也会从瞬态和持久性信息缓存中移除。
每个样本的‘过期时间’是通过将LIFESPAN QoS指定的持续时间加到源时间戳上来计算的。正如在2.2.2.4.2.11和2.2.2.4.2.12中所描述的,源时间戳要么是每次调用数据写入者的write操作时由服务自动计算的,要么是由应用程序通过write_w_timestamp操作提供的。
这个QoS策略依赖于发送和接收应用程序能够充分同步它们的时钟。如果不是这样,并且服务可以检测到它,那么数据读取者(DataReader)被允许在计算‘过期时间’时,使用接收时间戳代替源时间戳。
中文翻译和讲解:
生命周期(LIFESPAN)这一质量服务(QoS)策略的宗旨在于防止将过时的数据交付给应用程序。由数据写入者(DataWriter)写入的每个数据样品都会有一个相应的“有效期限”,一旦超出这个期限,该数据便不应再被交付给任何应用程序。样品过期后,相关数据将从数据读取者(DataReader)的缓存中删除,并且也会从临时和持久化信息缓存中清除。
每个样品的“有效期限”是通过在源时间戳上加上LIFESPAN QoS所规定的持续时长来计算得到的。正如在2.2.2.4.2.11和2.2.2.4.2.12节中描述的那样,源时间戳可能是由服务在每次调用数据写入者的write操作时自动计算的,也可能是由应用程序通过执行write_w_timestamp操作来提供的。
这个QoS策略依赖于发送方和接收方应用程序能够充分同步他们的时钟。如果时钟同步不足,并且如果服务能够检测到这一点,那么数据读取者(DataReader)被允许在计算“有效期限”时,使用接收时间戳替代源时间戳。