Commit Graph

30 Commits

Author SHA1 Message Date
Adam Hathcock 005b6224d0 adjust waits and actually save the root last (#5056)
* adjust waits and actually save the root last

* Update packages/objectloader2/src/core/objectLoader2.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-10 11:10:40 +01:00
Adam Hathcock f86893935f Change and fix BatchingQueue implementation (#5044)
* BatchingQueues allowed processing to happen more than one at a time.  Simplify and don't allow this.

* Use proper logging

* clean up and fix tests

* add more batchingqueue tests

* fixed according to AI

* fix: linting issues

* make deferment more intelligent and fix logging

* add to deferment tracking when bulk adding reads

* format

* fix tests
2025-07-10 10:13:58 +01:00
Adam Hathcock 1babe5859d safari fix: TextDecoder needs to be reset near 2 Gigs (#5048)
* safari fix: TextDecoder needs to be reset near 2 Gigs

* remove extra try/catch

* add back decoding for line error

* prettify
2025-07-10 10:13:24 +01:00
Adam Hathcock c5967a9616 (OL2) move files around to make more sense (#4950)
* Rename to saveBatch

* forgot a file

* first pass of cacheReader

* OL2 tests have infinite timeout

* OL2 refactor works

* fix for tests

* moved/removed types to make a more logical structure

* fixed imports

* rework loop to be in async generator for the expected count

* get rid of pumps and fix test

* lint fix

* redo mermaid diagrams

* add readme section on deferment

* always return root first

* fix linting

* revert the counting

* merge fixes

* remove unused var
2025-06-26 13:28:50 +01:00
Adam Hathcock 312f8083ab Progress for Traversal and Rendering alongside Data loading (#4899)
* Fix deferment logging

* Add count and total for traversal and rendering

* Prettier

* ESlint fixes

* Don't have a total for traversal

* revert lock change

* chore(viewer-lib): Added a comment abou render trees and reported node counts

* Traversal has no total

* ignore conversion total

* remove total for converted

* forgot a build breakage

* make the count callback optional

---------

Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
2025-06-19 10:08:38 +01:00
Adam Hathcock 2b828a5eeb (OL2) refactor read queue (#4948)
* Rename to saveBatch

* forgot a file

* first pass of cacheReader

* OL2 tests have infinite timeout

* OL2 refactor works

* fix for tests

* get rid of pumps and fix test

* lint fix

* redo mermaid diagrams

* add readme section on deferment
2025-06-17 08:24:05 +01:00
Adam Hathcock b11724eb6e fix(OL2): Deferment cleanup has to be a timer to not be concurrent (#4896)
* Deferment cleanup has to be a timer to not be concurrent

* Remove obsolete snapshot
2025-06-05 11:45:20 +01:00
Adam Hathcock 0b83f5e05d Deferment cleaning happens only on undefer and clean takes request count into account (#4886)
* Clean deferments on undefer

* Sort closures

* Track referenced item counts

* add tests

* run prettier again
2025-06-05 10:02:10 +01:00
Adam Hathcock 51dab0f4ee Remove getItem as we should use getItems with an array (#4862)
* Remove getItem as we should use getItems with an array

* remove getItem tests

* Update to latest and test

* Test memory downloader and memory db
2025-06-03 08:07:56 +01:00
Alexandru Popovici 3ca6757fdc fix(object-loader): Reduced max id request count to 25k to avoid 413 (#4871) 2025-06-02 15:05:04 +03:00
Adam Hathcock 36397a757c Add createFromUrl that can use memory database (#4870) 2025-06-02 12:57:30 +01:00
Adam Hathcock 9bb420c08b OL2: Dispose pump inline with the rest when disposing to kill loop (#4861) 2025-05-30 14:31:01 +01:00
Kristaps Fabians Geikins e743771d70 fix(objectloader2): stop excluding build from package (#4852) 2025-05-30 12:15:57 +03:00
Adam Hathcock 3a5d06bd21 OL2: add vide coded disposals and tests (#4790)
* add vide coded disposals and tests

* Fix prettier issues

* Fix tests
2025-05-22 15:05:20 +01:00
Adam Hathcock 2cba323bfd feat(main) objectloader2 should fail faster for missing json (#4578)
* feat(viewer-sandbox): Made a sandbox function that will only invoke the object-loader loading objects

* first pass of creating an objectloader2

* updated build + added vitest

* try to get viewer sandbox to use new code

* sandbox type fix

* refactor a bit

* can download root

* intermediate commit for downloader/caching queue

* can download stuff!

* refactor files

* intro isBase and fix isString

* move single download to downloader

* fix download

* PR feedback

* some intermediate commit

* do clean up and download better

* clean up promises and linting

* can generate values while downloading and caching

* add a finish method

* remove unused functions

* remove asBase

* add temporary docs

* add more docs with mermaid

* add more test models

* add response validation

* add tests and redo options

* add test for download batch

* fix downloader tests and change Item to have clearer Base items

* add tests and refactor a little

* use fetch in downloader as an option

* use optional in-memory indexdb instead of monkey patching the global one

* more refactors for options for objectloader2

* add tests for objectloader2

* adjust single download

* benchmark loading and adjust ol2 batches

* download more!

* adjust to use hash privates

* refactored again with renaming

* cleanup

* make setupCacheDb throw instead

* use BatchedPool for downloads!

* fix tests

* adjust timings and add adaptive waiting

* Only wait if queue wasn't empty and queue size was full

* fix tests

* fix file names and some private usage

* fix interval and private usage

* rename vars

* use params for methods

* fix params for constructors and tests

* fix params for constructors and tests again

* using dexie

* faster settings but doesn't end well

* fixed end, optimized and removed logs

* fix tests

* fix types?

* update lock with WSL

* add e2e small model test

* fix/update yarn.lock

* Remove unused eslint ignore to fix pre-commit

* prettier fixes

* fix real DB usage

* rename methods to better match OL1

* rename methods to better match OL1 again

* add extra header collection

* add headers correctly

* test getTotalObjectCount

* feat(viewer-lib): Replaced old object loader with Adam's  objectloder2

* fix(viewer-lib): Removed the old object loader. Removed unneeded pause time in speckle loader

* Testing

* only deferred if not downloaded....don't save everything

* Lockfile

* pool isn't adjustable, adjust download buckets, dexie read is faster

* chore

* fix(viewer-lib): Fixed compiler errors

* fix getObject access with real indexeddb...adjust buffer for deferred access

* Fix disposal and pausing

* don't index item!

* fix dockerfiles to use OL2

* fix Dockerfile

* Fix dockerfile

* defer correctly and use record to add/lookup/remove to

* delete stuff correctly

* chore(sandbox): Enabled viewer loading

* use objects instead of arrays to avoid findIndex

* remove extra count

* add a found cache to avoid some db hits

* order matters for deferment

* move found map to deferment

* change option numbers

* 2 level cache with expiry

* defer everything, use loader to track what is requested....expire only found items

* add deferment disposal

* oops mismerge

* chore(sandbox): Default stream

* Beta version of CachePump and CacheReader

* Clean up initialization

* More clean up

* chore(objectloader2): Fixed CI compiler error

* chore(objectloader2): Fixed prettier

* add cachePump tests

* add cacheReader tests

* fixed more tests

* fixed final tests

* moving stuff around and lock return value

* try to move stuff out of objectloader2

* use a factory

* rename factory

* formatting

* eslist fixes

* try allocating no strings

* add comments

* small refactor and add another test

* fix deferment expiration and have test

* use byte size for max memory cache size

* fix deferment manager tests

* use a set of keys to determine if the whole batch was gathered

* saved comment

* fix(viewer-sandbox): Fixed compiler error

* remove extra disposal

* simplify the error handling

---------

Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2025-05-22 08:29:50 +01:00
Adam Hathcock fbd74dafe1 fix serverDownloader disposal. Correct linting errors 2025-05-21 13:35:21 +01:00
Alexandru Popovici a385823b2d feat(viewer): objectloader2 integration (#4267)
* feat(viewer-sandbox): Made a sandbox function that will only invoke the object-loader loading objects

* first pass of creating an objectloader2

* updated build + added vitest

* try to get viewer sandbox to use new code

* sandbox type fix

* refactor a bit

* can download root

* intermediate commit for downloader/caching queue

* can download stuff!

* refactor files

* intro isBase and fix isString

* move single download to downloader

* fix download

* PR feedback

* some intermediate commit

* do clean up and download better

* clean up promises and linting

* can generate values while downloading and caching

* add a finish method

* remove unused functions

* remove asBase

* add temporary docs

* add more docs with mermaid

* add more test models

* add response validation

* add tests and redo options

* add test for download batch

* fix downloader tests and change Item to have clearer Base items

* add tests and refactor a little

* use fetch in downloader as an option

* use optional in-memory indexdb instead of monkey patching the global one

* more refactors for options for objectloader2

* add tests for objectloader2

* adjust single download

* benchmark loading and adjust ol2 batches

* download more!

* adjust to use hash privates

* refactored again with renaming

* cleanup

* make setupCacheDb throw instead

* use BatchedPool for downloads!

* fix tests

* adjust timings and add adaptive waiting

* Only wait if queue wasn't empty and queue size was full

* fix tests

* fix file names and some private usage

* fix interval and private usage

* rename vars

* use params for methods

* fix params for constructors and tests

* fix params for constructors and tests again

* using dexie

* faster settings but doesn't end well

* fixed end, optimized and removed logs

* fix tests

* fix types?

* update lock with WSL

* add e2e small model test

* fix/update yarn.lock

* Remove unused eslint ignore to fix pre-commit

* prettier fixes

* fix real DB usage

* rename methods to better match OL1

* rename methods to better match OL1 again

* add extra header collection

* add headers correctly

* test getTotalObjectCount

* feat(viewer-lib): Replaced old object loader with Adam's  objectloder2

* fix(viewer-lib): Removed the old object loader. Removed unneeded pause time in speckle loader

* Testing

* only deferred if not downloaded....don't save everything

* Lockfile

* pool isn't adjustable, adjust download buckets, dexie read is faster

* chore

* fix(viewer-lib): Fixed compiler errors

* fix getObject access with real indexeddb...adjust buffer for deferred access

* Fix disposal and pausing

* don't index item!

* fix dockerfiles to use OL2

* fix Dockerfile

* Fix dockerfile

* defer correctly and use record to add/lookup/remove to

* delete stuff correctly

* chore(sandbox): Enabled viewer loading

* use objects instead of arrays to avoid findIndex

* remove extra count

* add a found cache to avoid some db hits

* order matters for deferment

* move found map to deferment

* change option numbers

* 2 level cache with expiry

* defer everything, use loader to track what is requested....expire only found items

* add deferment disposal

* oops mismerge

* chore(sandbox): Default stream

* Beta version of CachePump and CacheReader

* Clean up initialization

* More clean up

* chore(objectloader2): Fixed CI compiler error

* chore(objectloader2): Fixed prettier

* add cachePump tests

* add cacheReader tests

* fixed more tests

* fixed final tests

* moving stuff around and lock return value

* try to move stuff out of objectloader2

* use a factory

* rename factory

* formatting

* eslist fixes

* try allocating no strings

* add comments

* small refactor and add another test

* fix deferment expiration and have test

* use byte size for max memory cache size

* fix deferment manager tests

* saved comment

* fix(viewer-sandbox): Fixed compiler error

* ignore tshy

* chore(frontend): Attempt to make viewer loading sequential

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2025-05-21 10:05:50 +03:00
Adam Hathcock 9586ca3a37 update time usage 2025-04-29 10:39:20 +01:00
Adam Hathcock ad93dafb35 Merge remote-tracking branch 'origin/main' into adam/createFromJson 2025-04-29 10:27:35 +01:00
Iain Sproat 920099c39f chore(readable code): use TIME_MS for readable durations
- we recently added TIME_MS helper; this applies it to existing durations
2025-04-18 17:51:43 +01:00
Adam Hathcock bedb649407 fix options 2025-04-14 10:34:55 +01:00
Adam Hathcock 7ac5b9afb0 add tests for memory usage for cache and download 2025-04-14 10:34:32 +01:00
Adam Hathcock 7f0390c51d add camelcase ignore 2025-04-10 17:11:08 +01:00
Adam Hathcock 5f35d1fc9b add traverse test 2025-04-10 14:30:12 +01:00
Adam Hathcock 7f2614cc00 add snapshot testing 2025-04-10 13:54:08 +01:00
Adam Hathcock 8705300557 add traverser 2025-04-10 11:10:21 +01:00
Adam Hathcock e0f17d421a make deferment manager and add tests for it and getObject 2025-04-09 16:44:59 +01:00
Adam Hathcock 8f67e52e38 deferred base usage correction 2025-04-09 15:50:24 +01:00
Adam Hathcock cfb561c1c2 add createFromObjects and createFromJSON 2025-04-09 15:13:32 +01:00
Adam Hathcock 975f0e1a51 feat(objectloader): ObjectLoader2: use indexdb as cache and batch download objects (#4172)
* feat(objectloader2): Made objectloader2 to be faster!

---------

Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2025-03-27 10:47:10 +00:00