ARK-Builders / arklib

Core of the programs in ARK family
MIT License
1 stars 10 forks source link

Update method should return complete resources with their details #37

Open kirillt opened 1 year ago

kirillt commented 1 year ago

ResourceIndex should pass complete resources with their details during update. Right now, only ResourceIds are passed. This causes the library clients to reconstruct details again.

See fun compute in Resource.kt (https://github.com/ARK-Builders/arklib-android): https://github.com/ARK-Builders/arklib-android/blob/f95ffc3b97c18e00f0cbed40b6b5c854254cab1c/lib/src/main/java/space/taran/arklib/domain/index/Resource.kt#L22

kirillt commented 1 year ago

It seems that not much of computation is duplicated. Core arklib (Rust) only computes ResourceId and a timestamp. Passing timestamp from the core would allow elimination of Files.getLastModifiedTime(path) expression. This is good for performance, but not critical.

kirillt commented 1 year ago

Actually, 2 calls to filesystem is made for each resource. And I've removed indexes caching at Kotlin side. So better to implement this richer structure passing from Rust side.