🚀 A simple but powerful application to store large and small files.
This repository has been archived on 2026-04-25. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • C++ 99.6%
  • CMake 0.2%
  • Makefile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
threadexio b3a118851c
Some checks failed
Run tests / build (push) Has been cancelled
Removed the default listen address on the server
2022-02-20 02:50:46 +02:00
.github CI stuff 2022-02-11 20:33:16 +02:00
.vscode Added IPv6 and unix support for the client 2022-02-20 02:31:21 +02:00
assets Added LICENSE, README 2022-01-30 18:54:33 +02:00
example Added custom hook support 2022-02-11 19:36:18 +02:00
src Removed the default listen address on the server 2022-02-20 02:50:46 +02:00
.clang-format Misc: clang-config style update 2021-12-07 21:54:03 +02:00
.gitignore Added custom hook support 2022-02-11 19:36:18 +02:00
.gitmodules Added basic command line arguments to the client 2022-01-25 16:01:18 +02:00
CMakeLists.txt Added LICENSE, README 2022-01-30 18:54:33 +02:00
Dockerfile Removed the default listen address on the server 2022-02-20 02:50:46 +02:00
LICENSE Added LICENSE, README 2022-01-30 18:54:33 +02:00
Makefile Makefile update 2022-02-18 19:47:01 +02:00
PROTOCOL.md Added type separators for verifiable data lengths 2022-02-06 15:42:53 +02:00
README.md Added supercool badges 2022-02-11 19:58:12 +02:00
run_tests.sh Added github workflows 2022-01-30 19:17:12 +02:00

sfsdb

GitHub Workflow Status GitHub Workflow Status

GitHub commits since latest release (by date) Docker Pulls

GitHub code size in bytes Docker Image Size (latest by date)

Simple File Storage DataBase

A simple but powerful application to store large and small files.

What's this?

sfsdb is a service that offers the ability to store and retrieve files via a set of commands. It was originally intended for use in webapps to provide a fast and dedicated space for storing files instead of putting them in the database. This option is more beneficial to the developer as it allows for greater flexibility and is only limited by the filesystem it is running under. For example, if your instance is running under btrfs you can snapshot all of the stored files with only one command, and theoretically even while the software is running. This flexibility allows the server to be shutdown and spun back up again extremely quickly with very little, if not zero, data loss.

How does it work?

It uses volumes, which are basically any directory that files can be stored on. These volumes keep a track of the files uploaded by giving them unique time-based identifiers. Because volumes are just directories, it is possible to change the mount at that directory to alter the purpose of the software. For example, you could mount a tmpfs filesystem, with sufficient size, on the volume and have the server act as a file cache instead of long-term storage.

Usage

All configuration can be done via command line parameters.

A docker image is also available here built from the latest release.

Building

As simple as:

$ make

The resulting server and command line client binaries can be found over at build/src/

Usage

Just run the binary with --help and it will explain everything you need to know. An example empty volume can be found in the example/ directory.

Hooks

Hooks reside in the root of each volume in a subdirectory called hooks and are executed with alphabetic wildcard order, to see the order of execution before running the server use ls | sort on the appropriate hook directory. A hook is any executable file, whether that would be an ELF file or a shell script or some other executable format is up to the user. Hooks can be used for example to mount the correct filesystem on startup or shutdown of the server or perform any other cleanup that might be required.

A hook can either run on startup if placed in hooks/pre.d/ or on shutdown if placed in hooks/post.d/.

If a hook exits with the magic value 164 the server will not execute the rest of the hooks and immediately exit.