An open-source scalable personal cloud

Metadata persistence

All metadata is stored in a database. We have created the following models:

  • User. It corresponds to a user in the StackSync system. It contains information related to accounts: email, storage quota, etc.
  • Device. A physical device owned by a user in which StackSync has been installed. A user may have more than one device, e.g., the home and work computers, a laptop, a mobile phone.
  • Workspace. By default, each user has one workspace, which corresponds with the root synchronized folder. When a user shares a folder with other users, a new workspace is created in the scope of the shared folder.
  • Object. A folder or a file. A workspace contains objects. It contains information such as the file name, path, type.
  • Version. An object has different versions that are created as users modify files and folders. Versions are submitted by devices. It contains information about the specific version such as the size, checksum, modification date.
  • Chunk. A version is composed by a set of chunks that form a specific object. A version will have one or more chunks if it is a file, or none if it is a folder.


To access or modify values stored in the database from the code we implemented the design pattern DAO (Data Access Object). With this pattern we are able to create a common interface between the application and the database. Furthermore, it also creates a factory in which we specify what kind of database we want to use (e.g., PostgreSQL, MySQL). This provides us with a modular persistence system, in which we can add different databases just implementing the DAO interfaces without modifying the code.