Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Major conceptual change: multiple files with the same names on the same DP, if they have different project #1542

@prioux

Description

@prioux

CBRAIN original, core, model for the files has always been that a DataProvider is like a standard filesystem folder, and that it can only hold one file with a particular name.

This restriction is still enforced on all DataProviders that are physically implemented as a single folder level (e.g. the Vault types, the FlatDir types, etc).

An deviation of that model was introduced for DPs that store each userfile in distinct filesystem location. For instance the EnCbrain types store each userfile in an filesystem subtree like 00/00/00/basename allowing multiple files named basename on the DP. These DPs are typically multi-user DPs, so we didn't want to prevent a user from having a file named 'abc.txt' if another user already had a file called 'abc.txt'. That being said, any single user cannot have two files with the same name on it.

The CBRAIN file management methods know which DP has which of these two capabilities by querying, as needed, the method content_storage_shared_between_users? :

  1. if it returns true then the DP is like a single folder
  2. if it returns false then the DP stores each userfile in separate location

What I'd like to introduce is an even more versatile version of the DP that store files in separate location. Instead of preventing a user from having two files with the same name, we would allow this provided the PROJECT name is distinct. This would turn the concept of a project in CBRAIN into something much more akin to an actual distinct folder.

What is required to get there is very complicated and tricky, however:

  1. All callbacks for userfile validations need to be updated to verify the special cases of these special new DPs.
  2. All file operations (copy, move, register, delete, update) need to be updated to make new checks about the capabilities of the DPs
  3. User need to be notified and informed about this, and warned about potential problems, because a typically a user has access to a whole set of data providers types, including the standard FlatDir types, and if they are not careful they could not realize that by moving/copying/creating a file in a project they could be affecting the content of another file instead.

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