On 02/11/2013 04:00 PM, Sage Weil wrote: > On Mon, 11 Feb 2013, Gregory Farnum wrote: ... > That doesn't really help; it means the mon still has to understand the > CLI grammar. > > What we are talking about is the difference between: > > [ 'osd', 'down', '123' ] > > and > > { > URI: '/osd/down', > OSD-Id: 123 > } > > or however we generically translate the HTTP request into JSON. I think the setup we have in mind is where the MON reads something like {"who:"osd", "which":"123", "what":"down", "when":"now"} from a socket (pipe, whatever), the CLI reads "osd down 123 now" from the prompt and pushes {"who:"osd", "which":"123", "what":"down", "when":"now"} into that socket, the webapp gets whatever: "/osd/down/123/now" or ?who=osd&command=down&id=123&when=now" from whoever impersonates the browser and pipes {"who:"osd", "which":"123", "what":"down", "when":"now"} into that same socket, and all three of them are three completely separate applications that don't try to do what they don't need to. > FWIW you could pass the CLI command as JSON, but that's no different than > encoding vector<string>; it's still a different way to describing the same > command. The devil is of course in the details: in (e.g.) python json.loads() the string and gives you the map you could plug into a lookup table or something to get right to the function call. My c++ is way rusty, I've no idea what's available in boost &co -- if you have to roll your own json parser then you indeed don't care how that vector<string> is encoded. -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu
Attachment:
signature.asc
Description: OpenPGP digital signature