Viet Nguyen
unread,Oct 11, 2011, 12:42:41 AM10/11/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to BSON
I am working with a device that runs on embedded linux and has a cgi
web server.
Because the resource is limited, I do not install a DB server, instead
I store data in separate JSON files, for instance config.json and use
JSON format for data protocol.
Handling request (GET) from browser is quite easy, because I just dump
the content of the file and Javascript code will do the rest.
However, processing file from backend is an issue. The JSON parser
library I used (YAJL) has an amazing feature which is stream parsing,
so I do not load all the file content into a buffer. I just concern
about performance when dealing with large file where my query field is
near the end of the file, because all JSON parsers need to read every
character.
Then I think BSON is a solution for data storage. I will only
translate between JSON and BSON i handling HTTP request.
My question is:
Is there any existing code/library that can process BSON format
directly from a file/stream? I mean theologically, it can be done
using fseek/fread; and BSON parser can fire a callback with the field
type, key name/length, value name/length. If not, where should I start
with?