Skip to content

Organise source code in app/, lib/ and tools/

Currently, all source code is located in various directories at the root level. This has a few disadvantages:

  • It clutters the root folder and is not standard: people looking at the repository for the first time won't immediately be able to locate the source code. The few large open source directories that have a similar flat structure at the root level have a clear mapping where every directory is a separate module.
  • It is unclear when you open a directory whether it is source code or something else
  • Similarly, it is not clear what is a library and what is an application/service. In the beginning, this can be confusing for e.g. the scheduler, as the name might suggest it is a service, while it is a library
  • It makes search exclusion/inclusion difficult as you cannot easily target all source code

We don't leave spoons all throughout the house. We put them in a drawer in the kitchen :)

Proposal

You will find various strategies from open-source repositories to deal with this: packages/, modules/, src/, <appname>/, app/, etc.

I would propose we go for app/, lib/ and tools/ as this clearly separates which directories are services/tools meant to be run by users and what are the libraries.

The mapping could be as follows:

  • cmdline/ -> app/cmdline/
  • common/ -> lib/common/
  • catalogue/ -> lib/catalogue/
  • cta-release/ -> app/cta-release/
  • disk/ -> lib/disk/
  • eos_grpc_client/ -> lib/eos_grpc_client/
  • frontend/ ->
    • frontend/common/ -> lib/frontend-common/
    • frontend/grpc/ -> app/frontend-grpc/
  • mediachanger/ -> app/mediachanger/ (would benefit from splitting out lib/mediachanger-client/)
  • objectstore/ -> lib/objectstore/
  • plugin-manager/ -> up for debate as it doesn't fit either very well. We could e.g. make a plugins/ directory or just put it in lib/
  • rdbms/ -> lib/rdbms/
  • scheduler/ -> lib/scheduler/
  • statistics/ -> tools/statistics/
  • tapeserver/ -> app/tapeserver/ (would benefit from some further splitting in the future)
  • xroot_plugins/ -> app/frontend-xrd/

Maybe there are still a few more libraries defined in app/ that can be split

Concluding Remarks

Making these changes will make it easier for new developers to understand the project structure and make the repository look cleaner, organised and mature.

In the future, we can then also enforce better standards on e.g. the lib/ directory, where all libraries have a proper structure with an include/, src/, test/ directory etc.

Edited by Niels Alexander Buegel