ARK-Builders / arklib

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

Tags storage #2

Closed kirillt closed 8 months ago

kirillt commented 2 years ago

Core feature of ARK Navigator is tags-based resources filtering. A resource identified by ResourceId can have multiple tags attached to it. A tag is just a string. This way, tags storage is just a mapping between identifiers and sets of strings.

The storage is persisted using hidden .ark-tags file. It is assumed, that .ark-tags file is replicated to other user devices (e.g. phone and tablet can have tags in sync) by using external software like Syncthing. This way, all user devices can have tags in sync.

In this task, loading and persisting of .ark-tags file must be ported from Kotlin to Rust. Functions of Storage interface must be implemented in the lib. The library must be stateful, keeping data in memory between calls. The library must support having several tag storages in memory simultaneously, so StorageId should be returned upon loading and be used in function calls by client app.

Loading of the storage should be done by passing root folder path from the client app, not by path of .ark-tags itself since structure of internal files can change in future and the library must automatically locate necessary internal files.

At this stage, it seems to be redundant to port Sharded storage. The most important is to stick storage format to the lib, so apps depending on the lib would always use the same format of tags storage.

kirillt commented 2 years ago

I think we should change .ark/tags from being single file into folder with separate file for each entry ResourceId -> Set<String>. This way it would be similar to .ark/previews folder, where each preview is an image stored under .ark/previews/resource_id path.

kirillt commented 8 months ago

Superseded by: