Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handsome refactoring and upgrades (I am going to kill god) #3

Merged
merged 33 commits into from
Mar 21, 2022

Conversation

luciusmagn
Copy link
Member

@luciusmagn luciusmagn commented Mar 19, 2022

Gentlemen, there is a couple of TODOs, but I still want to show you this cock.

This essentially rewrites testauskameli in such away, that you can reasonably easily add backends (shit like language playgrounds, latex, no meme?) and such that you can also somewhat easily add frontends (Discord, cli, http, whatever)

To create a backend:

  • Create a structure
  • Implement MrSnippet on it (named so in honor of Luukasa)

To create a frontend:

  • Do whatever you need to make a bot or sumshit
  • Create a structure, which has some way to hold MrSnippet trait objects, such that it is valid in an async, Send + Sync, interior mutability context
  • Implement Executor on said structure

To run the executor then, you just need to spawn a tokio::task that awaits the future from Executor::run.

You then send it inputs via a flume channel (in async mode, or youre mom gay), and with the Context type that you need to set for the executor trait, the executor will send the response messages automatically.

This is a WIP, here is a couple outstanding issues that I know of:

  • I want to implement the cli frontend, so that it is easier to test testauskameli locally
  • It needs testing
  • Haskell schizma:
    • The async Command provides both methods for unlimited and constrained execution
    • I think it is better to call shell scripts which do appropriate amount of limitation for languages like Haskell which need to be compiled, and thus these should be passed in there as env variables and the final call of the shell script shall be the sudo with s6 limits
    • Things that can be run directly better use the Command with limitations, ie. shell scripts
    • I don't have the haskell script yet lmao

The async command can also automatically create temporary directories and files to run the code in. The run methods which use any of the temporary IO return a FIles object along with a future in a tuple.

The Future is the actual command, awaiting it will run it.

The Files is a guard for the temporary files, once it's dropped, da files are gone

@luciusmagn
Copy link
Member Author

Another TODO is that no meme? is not concurrency safe, one call can preempt another and the wrong or worse, a corrupted image may be sent. Which would be incredibly funny, though

@lajp
Copy link
Member

lajp commented Mar 20, 2022

Another TODO is that no meme? is not concurrency safe, one call can preempt another and the wrong or worse, a corrupted image may be sent. Which would be incredibly funny, though

Yes, so far the development of this project has been focusing on functionality over correctness, but tissues like this are to be considered in the future.

@luciusmagn
Copy link
Member Author

It is an easy fix

@luciusmagn
Copy link
Member Author

Another TODO is that no meme? is not concurrency safe, one call can preempt another and the wrong or worse, a corrupted image may be sent. Which would be incredibly funny, though

Yes, so far the development of this project has been focusing on functionality over correctness, but tissues like this are to be considered in the future.

fixed in dc49297 and fa78d83

@luciusmagn luciusmagn changed the title I am going to kill god (WIP) (Help welcome) Handsome refactoring and upgrades (I am going to kill god) Mar 21, 2022
@lajp
Copy link
Member

lajp commented Mar 21, 2022

LGTM! Let's kill god!

@lajp lajp merged commit bf54a0b into Testausserveri:main Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants