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

Refactor cobalt into using an ECS #560

Open
epage opened this issue Nov 28, 2018 · 3 comments
Open

Refactor cobalt into using an ECS #560

epage opened this issue Nov 28, 2018 · 3 comments
Labels
enhancement Improve the expected

Comments

@epage
Copy link
Member

epage commented Nov 28, 2018

Cobalt's pure OOP architecture is causing problems

  • Hard to refactor processing stages
  • Hard to get all of the relevant state around to the relevant stages
  • A lot of work to add parallelism, even with rayon, due to the current scattering of code

Ideally any new architecture will

  • Make it easier for cobalt serve to reduce the amount of re-calculation on a filesystem notification

Proposal

Choice ECS

I am leaning towards specs due to its popularity.

Options

Comparisons

General Flow

Open Questions

  • Do we filter out drafts from ever being added to the ECS?
    • Not filtering simplifies the adding code
    • Filtering simplifies the processing cde

Systems

  • Generate permalink
  • Generate excerpts
  • Generate content
  • Generate pages

How we can add partial recalculation later

The filesystem watch can keep a change counter

  • On change, the filesystem watch updates the path's generation with the latest counter
  • Each system checks if the source's generation is older than the destination's and stops processing
  • Improvement?: Each system can check if the destination actually changed and not write to it, avoiding unnecessary re-calculations further down the pipeline

An interesting balance in this is not hurting the one-shot case's performance too much. We'll need to add benchmarks (in their own PR) and separately see how switching to an ECS, adding extra parallelism, choosing the ECS storage, and adding partial recalculation impact the performance.

@epage epage added the enhancement Improve the expected label Nov 28, 2018
@Geobert
Copy link
Contributor

Geobert commented Nov 28, 2018

I'm really interested in this subject as I'm quite new to ECS, trying to get the gist of it.

Filtering out drafts will make previewing our post harder, won't it?

I need to read the links before giving my opinion on if we should do ours or use one of the linked exemples

@epage
Copy link
Member Author

epage commented Nov 28, 2018

I'm really interested in this subject as I'm quite new to ECS, trying to get the gist of it.

The eye opening explanation for me was that it effectively is an in-memory, native database.

Filtering out drafts will make previewing our post harder, won't it?

I'm referring to the default case. It would still support the option to publish drafts

@Geobert
Copy link
Contributor

Geobert commented Dec 3, 2018

Other systems: 

  • Generate RSS
  • Copy assets?
  • Syntax highlighting?

Later:

  • Shortcode processing

What are the Components and The Entities?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve the expected
Projects
None yet
Development

No branches or pull requests

2 participants