Skip to content

Adapter pattern#142

Merged
christyjacob4 merged 4 commits intomainfrom
adapter-pattern
Mar 18, 2025
Merged

Adapter pattern#142
christyjacob4 merged 4 commits intomainfrom
adapter-pattern

Conversation

@basert
Copy link
Contributor

@basert basert commented Feb 20, 2025

This moves runner related code into an adapter.

@basert basert force-pushed the adapter-pattern branch 13 times, most recently from e90bc74 to 29e16c8 Compare February 20, 2025 15:29
* @param Table $statsContainers
* @return void
*/
public function init(Table $activeRuntimes, array $networks, Table $statsHost, Table $statsContainers): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we need to handle state like this also in the other adapter? If we do, can we have a parent class that handles this on a higher level? This will help us make adapters leaner and avoid having to pass this knowledge/tasks between adapters.

Can we also move this logic to the constructor instead of having an init method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed public init hook.

@basert basert force-pushed the adapter-pattern branch 7 times, most recently from 19973e7 to 536cbe3 Compare March 3, 2025 09:52
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To facilitate the edge router, and matching cloud structure, I propose this file structure:

app/init.php to initialise all the resources and adapters
app/controllers.php to contain all the executor routes. This would be used in only Appwrite CE.
app/http.php (currently run.php) to depend on the controllers and init and then start the server.

This way, in the edge, we can simply depend on the init and overwrite the resource with the runner adapter. What do you think?

@christyjacob4 christyjacob4 merged commit 135610f into main Mar 18, 2025
3 checks passed
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.

4 participants