ARK-Builders / arklib

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

#41: `update_one` tests #52

Closed oluiscabral closed 8 months ago

oluiscabral commented 11 months ago
kirillt commented 11 months ago

Should we create new struct for the error Collision("New content has the same id")? Word "Collision" can be confusing here since it can be caused not only by hash collision but also by wrong caller's code. The idea is that update_one is a quick way to update index without checking all resources in situations when the caller knows for sure that it was changed. E.g. when the caller edits the resource.

So, if the caller doesn't have information that the resource changed, it's a mistake to call this method. But if the resource was changed indeed (timestamp must be changed, too) and new content has same size and same CRC-32 hash — then it's a collision indeed.

We can also split single error into two different errors for clarity, depending on was the timestamp changed or not.

kirillt commented 8 months ago

Superseded by #72