Implement collections
This issue is for describing the functionality collections should have and tracking the status of our implementation. A major part of this feature needs to be implemented in the file-hooks repository.
Data model
A collection is a tree. The inner nodes of the tree are collections, the leaf nodes are atomic content. For example, the root could represent a course. The root's children could be weekly exercise sheets (also collections) and the children of these could be leaf nodes representing single exercises (atomic).
Description from a user's perspective
A repository in the sharing
group can be either atomic content or a collection. So far, everything has been atomic. Both atomic and collection repositories need a file named metadata.json
, metadata.yaml
, or metadata.yml
in the repository root directory in order to be indexed. This file needs to contain valid JSON/YAML as described in our Wiki. The field type
determines whether the repository is a collection. The repository is treated as a collection iff this field is set to collection
.
In a metadata file where type
is set to collection
, the field collectionContent
can be specified. This is a list of the collection's children, represented by their filename within the repository. All children of a collection must be in sub-directories of the directory where the collection metadata file is stored. At the locations specified by collectionContent
, there must be valid metadata files as described in the Wiki. Each of these referenced files can either represent a collection of atomic content. If there is an order to a collection's content, list the metadata files in this order. If the field type
is set to collection
but the field collectionContent
is not set, the repository's directories will be recursively searched for metadata files named one of the three aforementioned names. If such a file is found the search stops in the current directory and the rules specified in the file apply. This does not affect the search in the other directories.
Implementation
-
The health checks should be able to determine whether a collection is properly specified. It should detect cyclic specifications and check all metadata files which are part of a collection. -
If someone pushes a repository containing an invalid collection specification they should be notified about it, including the cause of the problem. -
Indexing needs to follow the rules outlined above to properly index a collection repository. Only valid collections should be indexed. -
If the specification of an indexed collection becomes invalid, all of the collection's content should be removed from the index. -
To properly handle indexed collections, an indexed collection should have references to the IDs of its children in the index. Conversely, each child should have a reference to the ID of its parent. -
Collections need to be represented in the front-end. From a collection, each child should be reachable. From a child in a collection, the parent should be reachable.