[kamaelia-list] Sedna Protocol for Kamaelia
Hi, all I'm releasing my code for a protocol for Sedna for Kamaelia. Or, maybe, I'm just letting it escape. In reality, I just stuck it in Sourceforge SVN, and anyone who wants to peek at it is welcome. :) What is Sedna? a very cool, free, multi-user XML database. http://modis.ispras.ru/sedna/index.htm Subversion command to fetch the new protocol code is: svn co https://zif.svn.sourceforge.net/svnroot/zif/zif.sedna/trunk/ zif.sedna You'll get both the synchronous zif.sedna.protocol and the asynchronous, kamaelia-ized zif.sedna.kamaelia.protocol. BSD-ish licensed. Copyright Virginia Tech. Sparse documentation, though python zif/sedna/kamaelia/protocol.py ought to give you a functional interactive prompt, if you first match config with your Sedna server. It's ~1100 lines of code, but that includes the cursor service and the console interpreter. Eventually, it may get properly modularized. The easiest way to make the checkout usable to python is sudo python setup.py develop. Michael, I thought about two-phase commit, but I'm thinking YAGNI (i.e., not worth the added complexity ATM) for my current project. I may revisit that idea sometime. Why Sedna -and- Kamaelia? Kamaelia makes concurrency/thread issues go away when you are dealing with a pool of authenticated connections, and you get a non-blocking interface included in the deal. With Sedna, you do not need an ORM; store tree-shaped data items directly as XML and retrieve them just the way you want with XQuery. Nice. Questions and comments welcome. If nothing else, it is one possible model for database access in Kamaelia. - Jim Washington --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups kamaelia group. To post to this group, send email to kamaelia@googlegroups.com To unsubscribe from this group, send email to kamaelia+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~--~~~~--~~--~--~---
[kamaelia-list] Re: Message framing over TCP
What I really want is a dead simple framing protocol that simply prefixes the message with a 16-bit number (or 32-bit number) that indicates the number of bytes that follow. I'm new to Python so I'm not quite sure how to go about this though. I wrote a proof-of-concept by using struct.pack(), but I'm not sure how to calculate the message length properly. E.g. if the message type is a unicode string len() will give me number of characters rather than the length of the string in bytes, correct? So any pointers before I go and implement my framing component properly? I think you're right - I'm pretty sure we don't have any components that provide quite what you're after. But they don't sound too difficult to write. Regarding the unicode issue - I'm not 100% sure, but I think this only becomes a problem in python 3.x. For better or worse (worse probably!) many existing Kamaelia components represent binary data as strings, and I think most of them use len() to determine the number of bytes contained in them. With your mention of bits, do I take it you're after conveying binary, rather than textual payloads? (eg. payloads that might contain byte values equivalent to characters such as newline) Would I also be right in guessing that you intend to pass these messages across a TCP connection, rather than as UDP packets? If either of these is the case, then the Framer and DeFramer components you spotted won't be up to the job, even if you did add dummy tag values. That said, I think it is perfectly reasonable to use the DataChunker and DataDeChunker components in the manner you describe - by sending a sync sequence immediately after a message to flush it through the dechunker. The other thing to consider is that you wouldn't actually need to frame the payload by prefixing it with its size - since the sync bytes delimit it. Probably would need a few extra components writing to achieve this though (or the creation of modified versions of DataChunker and DataDeChunker) Matt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups kamaelia group. To post to this group, send email to kamaelia@googlegroups.com To unsubscribe from this group, send email to kamaelia+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~--~~~~--~~--~--~---