skip block codec if store is Block aware#53
Conversation
|
Yeah, this is pretty nice actually. But .. you have a typescript problem to deal with now. See Lines 45 to 48 in fd113ad BlockLoader interface and make it accept a Loader|BlockLoader where it currently accepts a Loader? That's my suggestion for dealing with this anyway. I don't think it'd be reasonable to make a Loader require all 4 functions—although, one thing we could do is when accepting a Loader initially, to convert it to a BlockLoader internally so the code you've modified here only ever needs to deal with getBlock and putBlock and the Block stuff is abstracted away nicely.
|
Co-authored-by: Rod Vagg <rod@vagg.org>
Co-authored-by: Rod Vagg <rod@vagg.org>
|
Call me ghetto but I don't actually use TypeScript (yet !) - I don't know how to make the interface changes you mention. I can take a crack at it, but it might come out pretty butchered ! |
|
Yeah, fair enough, I'm not exactly a TS user myself although I'm heavily using TS annotations throughout JS code to do this kind of typechecking. Here's a slightly more complicated interface definition that might be helpful: https://github.com/rvagg/cborg/blob/master/interface.ts. You'll likely need to duplicate |
|
Ok thank you for the tips - also thank you for the libraries too - they are super useful to us |
As mentioned in #32 this is a patch for allowing us to work with blocks directly, which has increased our performance somewhat by avoiding the double encoding.
Please advise if another method of achieving this is preferrable.