Files
simple-object-server/README.md
Your Name 3db0208fe9 Tidyin g
2025-05-25 11:11:44 +12:00

64 lines
2.1 KiB
Markdown

# Simple Object Storage
## Introduction
Simple Object Storage is a very simple C++ webserver
which provides a store of tagged binary objects (the objects can be large),
which are available over http.
Read access is public.
Write access is controlled by tokens.
Public read actions:
### Retrieve Object
- 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/4528400792837739857`
- `curl http://localhost:8123/exists/squashkiwi:latest`
- `curl http://localhost:8123/exists/4528400792837739857`
### Retrieve Hash
- You can retrieve the hash for a given label and tag with, e.g.:
- `curl http://localhost:8123/hash/squashkiwi:latest`
### List Store Contents
- you can get a full list of {label:tag,hash} entries (one tag per entry) with:
- `curl http://localhost:8123/dir`
### Retrieve Metadata
- get all metadata for a tag:
- `curl http://localhost:8123/meta/squashkiwi:latest`
### Service Status Check
- quick status check:
- `curl http://localhost:8123/status`
Write actions:
### Upload Object
- to upload a file (via http put)
```
curl -X PUT \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@/path/to/your/file.txt" \
-F 'metadata={"labeltag":"example:latest","description":"Example file","tags":["test","example"],"custom_field":"custom value"}' \
"http://localhost:8123/upload"
```
- the object_file is uploaded, hashed, added to the registry (if that hash doesn't already exist), and {label:tag,hash} entries are added to the directory index.
- matching tags on older versions are removed.
### Delete Object
- to delete an object (and all tags on that object):
- `curl http://localhost:8123/deleteobject?token="WRITE_TOKEN"\&hash="HASH"`
## Configuration
- the server is configured via ~/.config/simple_object_storage/config.json which allows setting:
- the list of write access tokens
- the location for the object store (path on disk)
Dockcross is used to cross-build for both 64-bit x86 and arm64 (combining both into one docker container image).