[Standards-JIG] Proposal for Ordered Nodes.

Peter Saint-Andre stpeter at jabber.org
Thu Jun 8 21:01:31 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As long as this is entirely OPTIONAL I don't have deep objections to it,
though I'd like to look at it a bit more before I come to any final
conclusions (e.g., what if a client includes the beforeID or afterID and
the service does not support ordering of items?). Feedback from various
implementors would also be good (Ralph? Gaston?). Finally you might want
to describe a scenario in which this functionality is helpful.

In general I think it's best to leave the order-handling up to the
service so that the clients don't need to be smart. Thus if you want to
publish an item to the end of an ordered list, just publish it without
an afterID and the service will assign the afterId to be the last
(previously published) item.

Peter

Brian Raymond wrote:
> In an attempt to provide more flexibility in PubSub I would like to propose
> the addition of ordering to PubSub nodes. This allows items published to a
> node to occur in a specified order. Any type of data that requires the
> processing of data elements in order can benefit from this addition since
> the order of items can be managed and the service can enforce that order.
> This was born out of a use case for PubSub in my work where the data being
> disseminated to clients requires an order so they can all maintain a
> consistent representation of that data as it changes over time.
> 
> I tried to make this addition fairly lightweight while capturing what is
> needed to allow an order to be specified and maintained. The schema updates
> add some length to it though. I'm hoping I didn't miss anything in trying to
> keep it slim.
> 
> Please consider this addition to PubSub.
> 
> Thanks,
> 
> - Brian
> 
> ----
> Ordered nodes
> 
> A pubsub service MAY support ordering of the children for collection nodes
> and leaf nodes. A configuration boolean option of "pubsub#ordered" controls
> whether or not a node is an ordered node.
> 
> 16.4.3
> 
>   <field var='pubsub#ordered'
>          type='boolean'
>          label='Whether a node contains children that have an enforced
> order.'/>
> 
> 
> The preceding is sufficient to indicate that the children returned for a
> node are ordered (meaning that the service did not arbitrarily deliver
> things in a different order then how they were added) however it does not
> address subscription notifications, or inserts and moves.
> 
> 
> A PubSub service that implements ordered nodes MUST support the ability to
> insert items into an ordered list or move them within the list. Two
> attributes in <item/> or <create/> elements allows the order to be expressed
> by clients and the PubSub service. The "beforeId" attribute indicates the ID
> of the item this item succeeds in the list and the "afterId" attribute
> indicates the ID of the item this item precedes in the list. If the client
> is attempting to insert a new item anywhere in the list the "beforeId" and
> "afterId" indicate the position of the element for the service. If an
> existing item needs to be moved the "beforeId" and "afterId" attributes with
> an item publish or node create for an existing ID indicate the new position.
> An insert or move to the beginning of the list MUST include the "beforeId"
> attribute and MUST NOT include the "afterId" attribute. An insert of move to
> the end of the list MUST include the "afterId" and MUST NOT include
> "beforeId" attribute.  If the client is attempting to insert or move an item
> between other items  the "beforeId" and "afterId" attribute both MUST be
> present. The only time when neither attribute is required is with the first
> child is added.
> 
> As inserts and moves are made the service MUST update the "beforeId" and
> "afterId" attributes for those elements it changes for. Those attributes are
> used to indicate order for subscription notifications.
> 
> Example: Insert a new item at the beginning of the list
> 
> <iq type='set'
>     from='hamlet at denmark.lit/blogbot'
>     to='pubsub.shakespeare.lit'
>     id='publish1'>
>   <pubsub xmlns='http://jabber.org/protocol/pubsub' >
>     <publish node='princely_musings'>
>       <item id='ae890ac52d0df67ed7cfdf51b644e901'
> beforeId='231408c0f4e311da974d0800200c9a66' >
>         <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>
>   </pubsub>
> </iq>
> 
> Example: Insert a new item at the end of the list
> 
> <iq type='set'
>     from='hamlet at denmark.lit/blogbot'
>     to='pubsub.shakespeare.lit'
>     id='publish1'>
>   <pubsub xmlns='http://jabber.org/protocol/pubsub' >
>     <publish node='princely_musings'>
>       <item id='ae890ac52d0df67ed7cfdf51b644e901'
> afterId='44dc6920f4e311da974d0800200c9a66' >
>         <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>
>   </pubsub>
> </iq>
> 
> Example: Insert a new item in the middle of the list
> 
> <iq type='set'
>     from='hamlet at denmark.lit/blogbot'
>     to='pubsub.shakespeare.lit'
>     id='publish1'>
>   <pubsub xmlns='http://jabber.org/protocol/pubsub' >
>     <publish node='princely_musings'>
>       <item id='ae890ac52d0df67ed7cfdf51b644e901'
> beforeId='231408c0f4e311da974d0800200c9a66'
> afterId='44dc6920f4e311da974d0800200c9a66' >
>         <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>
>   </pubsub>
> </iq>
> 
> Example: Insert an existing item in the middle of the list
> 
> <iq type='set'
>     from='hamlet at denmark.lit/blogbot'
>     to='pubsub.shakespeare.lit'
>     id='publish1'>
>   <pubsub xmlns='http://jabber.org/protocol/pubsub' >
>     <publish node='princely_musings'>
>       <item id='ae890ac52d0df67ed7cfdf51b644e901'
> beforeId='231408c0f4e311da974d0800200c9a66'
> afterId='44dc6920f4e311da974d0800200c9a66' >
>       </item>
>     </publish>
>   </pubsub>
> </iq>
> 
> A node is handled in the same fashion with the "beforeId" and "afterId"
> attributes added to the <create/> element.
> 
> Example: Insert an existing node in the middle of the list
> 
> <iq type='set'
>     from='hamlet at denmark.lit/elsinore'
>     to='pubsub.shakespeare.lit'
>     id='create1'>
>     <pubsub xmlns='http://jabber.org/protocol/pubsub'>
>       <create node='princely_musings'
> beforeId='231408c0f4e311da974d0800200c9a66'
> afterId='44dc6920f4e311da974d0800200c9a66'/>
>     </pubsub>
> </iq> 
> 
> Subscription notifications MUST include the "beforeId" and "afterId"
> attribute if set to communicate the order of the element to subscribers.
> 
> Schema updates:
> 
> 17.1
>   <xs:element name='create'>
>     <xs:complexType>
>       <xs:simpleContent>
>         <xs:extension base='empty'>
>           <xs:attribute name='node' type='xs:string' use='optional'/>
>           <xs:attribute name='beforeId' type='xs:string' use='optional'/>
>           <xs:attribute name='afterId' type='xs:string' use='optional'/>
>           <xs:attribute name='type' use='optional' default='leaf'>
>             <xs:simpleType>
>               <xs:restriction base='xs:NCName'>
>                 <xs:enumeration value='collection'/>
>                 <xs:enumeration value='leaf'/>
>               </xs:restriction>
>             </xs:simpleType>
>           </xs:attribute>
>         </xs:extension>
>       </xs:simpleContent>
>     </xs:complexType>
>   </xs:element>
> 
> <xs:element name='item'>
>     <xs:complexType>
>       <xs:sequence minOccurs='0'>
>         <xs:any namespace='##other'/>
>       </xs:sequence>
>       <xs:attribute name='id' type='xs:string' use='optional'/>
>       <xs:attribute name='beforeId' type='xs:string' use='optional'/>
>       <xs:attribute name='afterId' type='xs:string' use='optional'/>
>     </xs:complexType>
>   </xs:element>
> 
> 17.3
>  <xs:element name='item'>
>     <xs:complexType>
>       <xs:choice minOccurs='0'>
>         <xs:any namespace='##other'/>
>       </xs:choice>
>       <xs:attribute name='id' type='xs:string' use='optional'/>
>       <xs:attribute name='node' type='xs:string' use='optional'/>
>       <xs:attribute name='beforeId' type='xs:string' use='optional'/>
>       <xs:attribute name='afterId' type='xs:string' use='optional'/>
>     </xs:complexType>
>   </xs:element>
> 
> The addition of a new error <ordered-conflict/> allows the service to
> indicate that the operation with the specified order could not be completed.
> This generally means another publisher made a change shortly before this
> change was attempted.
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEiJAqNF1RSzyt3NURAlboAKDhefVIoL2iztrMs8bcxih/JA4MZACgn/j0
T3MDvgvhOtb3V260X5gcKCc=
=eELa
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3641 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.jabber.org/pipermail/standards/attachments/20060608/49146626/attachment.bin>


More information about the Standards mailing list