barzerman / barzer

barzer engine code
MIT License
2 stars 0 forks source link

implement limited scope BSON response encoder #614

Closed barzerman closed 10 years ago

barzerman commented 11 years ago

implement a generic class to encode BSON http://bsonspec.org/#/specification

the official mongodb implementation seems rather unwieldy and the code looks crappy

barzerman commented 11 years ago

transfering ownership to @0xd34df00d . whats left to do: 1) validate it (by comparing against the mongodb supplied one) 2) performance test it (also against theirs)

barzerman commented 11 years ago

how is this going?

0xd34df00d commented 11 years ago

The tester is ready (as well as test generator), and right now I'm debugging our encoder — it fails even for a simple { "hello": "world" } from spec examples (though I cannot understand how that example conforms to their own spec, the length seems to be miscalculated).

barzerman commented 11 years ago

are you working on the fixes?

On Thu, Aug 29, 2013 at 5:56 PM, Georg Rudoy notifications@github.comwrote:

The tester is ready (as well as test generator), and right now I'm debugging our encoder — it fails even for a simple { "hello": "world" }from spec examples (though I cannot understand how that example conforms to their own spec, the length seems to be miscalculated).

— Reply to this email directly or view it on GitHubhttps://github.com/barzerman/barzer/issues/614#issuecomment-23526668 .

www.barzer.net

0xd34df00d commented 11 years ago

Trying to. The shit is hard, we seem to miscalculate the reverse fixes and the output is generally so incorrect that it's hard to fix it.

barzerman commented 11 years ago

i believe in you. you can work through very hard shit. let me knmow if you need help

On Thu, Aug 29, 2013 at 6:05 PM, Georg Rudoy notifications@github.comwrote:

Trying to. The shit is hard, we seem to miscalculate the reverse fixes and the output is generally so incorrect that it's hard to fix it.

— Reply to this email directly or view it on GitHubhttps://github.com/barzerman/barzer/issues/614#issuecomment-23527185 .

www.barzer.net

0xd34df00d commented 11 years ago

Ok, nested docs bug almost fixed, let this be here for the history:

% hexdump-esr *stock *out
---- 06.bson.stock ----
0000  0c 00 00 00 03 00 05 00  00 00 00 00              ........ ....
---- 06.bson.out ----
0000  0c 00 00 00 03 07 00 00  00 00 00 00              ........ ....
0xd34df00d commented 11 years ago

Test also against this: https://github.com/mongodb/libbson

barzerman commented 11 years ago

i will be moving this to ay and merging into master

0xd34df00d commented 11 years ago

Why ay? We spoke about separate repo.

barzerman commented 11 years ago

within barzer it will be in bson/ subdirectory. i dont want to make barzer repo dependent on any other repo. so the other repo is for opensourcing it

0xd34df00d commented 11 years ago

git submodules

barzerman commented 11 years ago

fine. the file should be named cppbson. not barzer_bson

On Thu, Sep 5, 2013 at 2:06 PM, Georg Rudoy notifications@github.comwrote:

git submodules

— Reply to this email directly or view it on GitHubhttps://github.com/barzerman/barzer/issues/614#issuecomment-23889066 .

www.barzer.net

barzerman commented 11 years ago

actually let's call it EBSON11 ?

0xd34df00d commented 11 years ago

Personally I would call it bson++ or smth. Ebson is funny for Russian ear, dunno if it is good for our image of a serious company though.

barzerman commented 11 years ago

crono is a boost library so this doesnt build on mac .

0xd34df00d commented 11 years ago

Can you finally arrange to use C++11 on your mac?

barzerman commented 11 years ago

no. also we need a small standalone demo file (which im making now) to encode JSON using ebson11 bsontest.cpp is just for benchmark testing and we shouldnt really be distributing it

On Thu, Sep 5, 2013 at 7:28 PM, Georg Rudoy notifications@github.comwrote:

Can you finally arrange to use C++11 on your mac?

— Reply to this email directly or view it on GitHubhttps://github.com/barzerman/barzer/issues/614#issuecomment-23909188 .

www.barzer.net

barzerman commented 11 years ago

this is wrong

194     EncoderT(size_t reserve = DEFAULT_RESERVE_SZ)
195     {
196         d_buf.reserve(reserve);
197         stackPush();
198     }

encoder constructor absolutely shouldnt push anything preemptively

0xd34df00d commented 11 years ago

It should. Root document start and end are special cases. This imposes no perf hit at all, so I don't understand why we should overcomplicate the interface just because you consider so.

barzerman commented 11 years ago

last thing: pls add encode_binary to the encoder. i think it's a very popular type for wire formats

barzerman commented 11 years ago

reopening: are arrays working as designed?

0xd34df00d commented 11 years ago

This issue shouldn't have been closed in the first way, dumb github.