New version!

A new version of this website is available at architectural-patterns.net.

The repository contains a single datastructure, the Repository, and a number of modules called Knowledge Sources, that modify this datastructure. These are the only characteristics of a repository architecture. If all these Knowledge Sources start modifying at the same time, all hell breaks loose. Therefore the order in which they have access needs to be regulated.

Examples

  • Database.
  • Compiler. Modern compilers use the same datastructure in successive stages of the compilation process.

When should you use it?

Use it when the data of your application is a goal in itself, or when its too costly to transfer the data all the time.

How does it work?

All knowledge sources can read/write to the repository. The way all these interactions are synchronized is up to the repository and the way the repository is used.


Repository architecture

Compilers use a repository. The stages of the compiler are performed successively. This way the repository is used orderly.

Databased are repositories. Since all clients of the database may be active at the same time, the database needs to implement locking mechanisms to ensure the integrity of the repository is kept intact.

Problems

  • Synchronisation. Requires special attention if the Repository is approached in parallel by several Knowledge Sources.