Skip to content

repository implementation: writing/reading config file from backend is inconsistent #2498

@aawsome

Description

@aawsome

The backend-interface works as follows:

  • Files are accessed by a Handle
  • the Handle consists of a Type of the file and the ID
  • usually the ID should be equal to the SHA-256 Hash of the content

For the config file, there is an exception which is implemented for each backend and also in the repository implementation.
For instance in internal/repository/repository.go func LoadAndDecrypt the Hash is not checked for ConfigFile. This is necessary as the config file is accessed without knowing the ID (i.e. with zero ID).

But in fact, in the same repository implementation in func SaveUnpacked the ID is computed as Hash of the content.

So the backends get a Save request for (ConfigFile, ID) with the correct Hash ID and a Read request for (ConfigFile, ID{}) (empty ID).

Luckily all backends handle ConfigFile requests as special case and hence this is no real bug ATM.
However I consider this a inconsistent design and suggest to correct it.

I'm about to file a pull request and just want to discuss it in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions