yocontra / node-gdal-next

Node.js bindings for GDAL (Geospatial Data Abstraction Library) [Fork]
https://contra.io/node-gdal-next/
Apache License 2.0
75 stars 35 forks source link

Early experimental async support #19

Closed mmomtchev closed 3 years ago

mmomtchev commented 3 years ago

Over the weekend, I have started implementing async support here: https://github.com/mmomtchev/node-gdal-async The current version is of alpha quality and supports only open() and raster read() My use case is reading data from Express and this is more or less covered It is too early to merge it back, but if anyone wants to try it, I will appreciate your feedback

mmomtchev commented 3 years ago

@contra, there is almost nothing (maybe one code depup?) that is independent of the async code which is potentially breaking - because of the new locking scheme I am getting ready for a first push once I

mmomtchev commented 3 years ago

Proposal: The user sees only one of each openAsync/writeAsync/readAsync and it is an async function If its last argument is a callback, that callback is called on completion Otherwise it returns a Promise (in fact the Promise is always returned) This will be implemented in lib/gdal.js

And all the low-level C++ functions stay as they are now, with up to 15 arguments and standard (e, r) callback semantics

mmomtchev commented 3 years ago

@contra, I am sorry but it has been ages since I compiled anything on Windows, what is the current "standard" C++ compiler? There is Visual Studio Community 2019 which is a full IDE? And also Visual Studio Build Tools which is a CLI-only compiler but it is stuck in 2015?

yocontra commented 3 years ago

I also haven't used windows in almost 10 years - no clue how any of that stuff works tbh. This repo is set up using visual studio 2015 to build on windows, there are newer versions available than that but they introduce breaking changes and I didn't have time to deal with it given all of the other stuff that needed updating. I spent a couple of hours trying to update the windows build and decided it wasn't worth the time since what is there was working fine enough.

mmomtchev commented 3 years ago

Yes, it doesn't build with Studio 2019 but Studio 2019 allows you to install MSVC 140 from Studio 2015 for CLI usage. So currently MSVC 140 is required, and me too I am inclined to leave it in this state. Unit testing passes in Release mode. The Debug build does not compile, but it is because of a GDAL problem that has been submitted and fixed upstream. Still waiting for feedback, but I think that the raster async is more or less ready for merging.

mmomtchev commented 3 years ago

I am ready to push the first half of the async code (the raster data) However as this is a far-reaching change because of the new locking, I would really be more comfortable with some feedback

yocontra commented 3 years ago

@mmomtchev Haven't had time to dive really deeply into it yet, hopefully this weekend I can do a review pass.

FWIW I don't do C++ full time (never have) so I will probably defer to your judgement on the implementation in that regard.