[Standards] Proposed XMPP Extension: Atomically Compare-And-Publish PubSub Items

Kim Alvefur zash at zash.se
Thu Aug 24 20:40:43 UTC 2017


Hi,

On Thu, Aug 24, 2017 at 12:10:33PM -0000, Jonas Wielicki wrote:
> Title: Atomically Compare-And-Publish PubSub Items
> Abstract:
> This specification provides a mechanism to atomically Compare-And-
> Publish items to a PubSub node.

Why not define this as a publish-options field?

Eg something like this:

``` xml
<iq type="set" from="hamlet at denmark.lit/blogbot" to="pubsub.shakespeare.lit" id="pub1">
	<pubsub xmlns="http://jabber.org/protocol/pubsub">
		<publish node="princely_musings">
			<item id="2">
				<entry xmlns="http://www.w3.org/2005/Atom">
					<title>Soliloquy</title>
					<summary>
To be, or not to be: that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them?
				</summary>
					<link rel="alternate" type="text/html" href="http://denmark.lit/2003/12/13/atom03"/>
					<id>tag:denmark.lit,2003:entry-32397</id>
					<published>2003-12-13T18:30:02Z</published>
					<updated>2003-12-13T18:30:02Z</updated>
				</entry>
			</item>
		</publish>
		<publish-options>
			<x xmlns="jabber:x:data" type="submit">
				<field var="FORM_TYPE" type="hidden">
					<value>http://jabber.org/protocol/pubsub#publish-options</value>
				</field>
				<field var="urn:xmpp:pubsub:cap:0#previd">
					<value>1</value>
				</field>
			</x>
		</publish-options>
	</pubsub>
</iq>
```

Since publish-options is defined such that you can register fields in it
as preconditions, having a precondition on the previous last ID seems
fairly natural.

-- 
Regards,
Kim "Zash" Alvefur


More information about the Standards mailing list