This commit is contained in:
Your Name
2025-05-03 15:37:17 +12:00
parent 085ace7914
commit d678f1923e

View File

@@ -3,38 +3,49 @@
## Introduction ## Introduction
Simple Object Storage is a very simple C++ webserver Simple Object Storage is a very simple C++ webserver
which provide a store of binary objects (the objects can be large), which provides a store of tagged binary objects (the objects can be large),
which are available over http. which are available over http.
Read access is public. Read access is public.
Write access is controlled by tokens. Write access is controlled by tokens.
Public read actions:
- Objects are access via a label and tag, or via their hash. For example: - Objects are access via a label and tag, or via their hash. For example:
- `wget http://localhost:8123/object/squashkiwi:latest` - `wget http://localhost:8123/object/squashkiwi:latest`
- `wget http://localhost:8123/object/4528400792837739857` - `wget http://localhost:8123/object/4528400792837739857`
- The hash is calculated using `uint64_t hash_file(const std::string &path);` in hash.hpp.
- You can retrieve the hash for a given labvel and tag with, e.g.: - `curl http://loclahost:8123/exists/squashkiwi:latest`
- `curl http://localhost:8123/exists/4528400792837739857`
- You can retrieve the hash for a given label and tag with, e.g.:
- `curl http://localhost:8123/hash/squashkiwi:latest` - `curl http://localhost:8123/hash/squashkiwi:latest`
- you can get a full list of {label:tag,hash} entries (one tag per entry) with: - you can get a full list of {label:tag,hash} entries (one tag per entry) with:
- `curl http://localhost:8123/dir` - `curl http://localhost:8123/dir`
- get all metadata for a tag: - get all metadata for a tag:
- `curl http://localhost:8123/meta/squashkiwi:latest` - `curl http://localhost:8123/meta/squashkiwi:latest`
- a simple welcome page is served at `/index.html` for those browsing to the site.
Write actions:
- to upload a file (via http put) - to upload a file (via http put)
- `curl -T object_file http://localhost:8123/upload?token="WRITE_TOKEN"\&labeltag="LABEL:TAG"\&filename="FILENAME"` - `curl -T object_file http://localhost:8123/upload?token="WRITE_TOKEN"\&labeltag="LABEL:TAG"\&filename="FILENAME"`
- the object_file is uploaded, hashed, added to the registry (if that hash doesn't already exist), and {label:tag,hash} is added to the directory index. - the object_file is uploaded, hashed, added to the registry (if that hash doesn't already exist), and {label:tag,hash} is added to the directory index.
- to delete a label/tag (object remains): - to delete a label/tag (object remains):
- `curl http://localhost:8123/deletetag?token="WRITE_TOKEN"\&labeltag="LABEL:TAG"` - `curl http://localhost:8123/deletetag?token="WRITE_TOKEN"\&labeltag="LABEL:TAG"`
- to delete an object (and all tags on that object): - to delete an object (and all tags on that object):
- `curl http://localhost:8123/deleteobject?token="WRITE_TOKEN"\&hash="HASH"` - `curl http://localhost:8123/deleteobject?token="WRITE_TOKEN"\&hash="HASH"`
- add a tag to an existing object: - add a tag to an existing object:
- `curl http://localhost:8123/appendtag?token="WRITE_TOKEN"\&hash="HASH"\&labeltag="LABEL:TAG"` - `curl http://localhost:8123/appendtag?token="WRITE_TOKEN"\&hash="HASH"\&labeltag="LABEL:TAG"`
- the server is configured via a configuration file which allows setting:
- the server is configured via ~/.config/simple_object_storage/config.json which allows setting:
- the list of write access tokens - the list of write access tokens
- the location for the object store (path on disk) - the location for the object store (path on disk)
The C++ program is written so that it only uses standard libraries, and is built as a static executable with musl not glibc.
The C++ program is built with cmake. Dockcross is used to cross-build for both 64-bit x86 and arm64 (combining both into one docker container image).
A Dockerfile is included for conveniently running the C++ program inside docker.