Tais993 / Picture-Projects-tool

Tool which'll help with maintaining projects
0 stars 0 forks source link

Async image loading #1

Open Tais993 opened 1 year ago

Tais993 commented 1 year ago

Image loading currently happens sync, so opening a project can vary from a second or 2, to minutes.

This should happen async, the view should instantly be opened. Images should be lazy loaded, since that'd allow the user to actually use the application, without having minutes of waiting time.

This doesn't mean that every feature instantly works, some features can wait for the project to load.

Tais993 commented 10 months ago

Did some thinking.

How currently images are loaded will be completely reworked. A new design will be used;

I will create a supplier, this supplier will store all files in the directory. I'll add listeners to the supplier, those listener receive "create, update and delete" events.

On initialization, the supplier will read all files and send one by one a create event. This means that loading everything will happen completely unrelated to the main application. Single responsibility, this will make optimizing the workflows much easier, and much more maintainable.

Tais993 commented 10 months ago

Did more thinking, image supplier will have 2 additional responsibilities.

This will also mean a rework, to maintain single responsibility. Which results in a file and image supplier, combined with another class for the DB/cache

File supplier / watch service This will listen to all file updates, instead of returning an Image this will return the actual file. In what format/type, I'm uncertain of at this moment.

DB/Cache This will be an universal interface allowing for easy retrieving from either the cache or the DB, not both.

Image Supplier This will supply the actual images, it'll remove any duplicates, and make sure the event contains both the old and new file. Hopefully the image supplier will be smart enough to track renames, and other alike changes.

This will also allow for telling the back-end whenever to reload the image, or the metadata.