awslabs / llrt

LLRT (Low Latency Runtime) is an experimental, lightweight JavaScript runtime designed to address the growing demand for fast and efficient Serverless applications.
Apache License 2.0
8.04k stars 355 forks source link

Splitting Lambda specific parts out of llrt_core #351

Open KaanMol opened 5 months ago

KaanMol commented 5 months ago

After splitting LLRT up in 2 parts llrt and llrt_core the next step would be to look for a way to split lambda logic out of LLRT to its own thing.

Options would be:

The AWS libraries would also be stripped out of llrt_core. @richarddavison gave the solution for that here.

The ConsoleModule will require the most effort to split in two parts, in issue #341 it was stated that this module could be rewritten. @richarddavison would you happen to know when this is planned? My current solution for this would be to put the default ConsoleModule without the Lambda logic in llrt_core and in the Lambda feature flag/lambda package it would contain its own version of the module that would be used instead of the default one, since the module builder would allow for that now. We could make the utils for the console modules public, so the other package could just use the methods it needs.

If you have any other ideas on how to do this, please let me know :)

richarddavison commented 5 months ago

After splitting LLRT up in 2 parts llrt and llrt_core the next step would be to look for a way to split lambda logic out of LLRT to its own thing.

Options would be:

  • llrt, llrt_core and llrt_lambda or something like it;
  • llrt (with a feature flag lambda) and llrt_core;

The AWS libraries would also be stripped out of llrt_core. @richarddavison gave the solution for that here.

The ConsoleModule will require the most effort to split in two parts, in issue #341 it was stated that this module could be rewritten. @richarddavison would you happen to know when this is planned? My current solution for this would be to put the default ConsoleModule without the Lambda logic in llrt_core and in the Lambda feature flag/lambda package it would contain its own version of the module that would be used instead of the default one, since the module builder would allow for that now. We could make the utils for the console modules public, so the other package could just use the methods it needs.

If you have any other ideas on how to do this, please let me know :)

I will rewrite console after and it should not affect this. The only thing the differs Lambda console from the regular console is how it's formated before output. My suggestion here would be to have two console implementations. The base console and the Lambda console. That implement ConsoleModule trait which contains all the methods.