2 releases

0.1.1-unstable Mar 2, 2024
0.1.0-unstable Feb 26, 2024

#27 in #http-post

49 downloads per month

EUPL-1.2

75KB
1.5K SLoC

yeet/yoink — A file storage and retrieval service

WIP Latest version License Language Build Status Issues Dependency Status Code size

A service to which you can yeet your files in order to yoink them from somewhere else. This is meant to simplify cluster-local file sharing with configurable persistence backends.

One key aspect here is that a service like this can offload communication with object storage, databases or other systems, allowing the actual storage and retrieval within the application to be reduced to a simple HTTP POST and GET, given a file ID.

⚠️ This service is work in progress.

sequenceDiagram
    autonumber
    
    Alice->>Alice's yeyo: do yeet
    activate Alice;
    Note over Alice,Alice's yeyo: Alice stores a file
    activate Alice's yeyo;
    Alice's yeyo -) Storage Backend: take file;
    activate Storage Backend;
    deactivate Storage Backend;
    Alice's yeyo-->>Alice: okie #9829;
    deactivate Alice's yeyo;
    deactivate Alice;

    Bob->>Bob's yeyo: do yoink
    activate Bob;
    Note over Bob,Bob's yeyo: Bob needs the file
    activate Bob's yeyo;
    Bob's yeyo ->> Alice's yeyo: maybe yoink?
    activate Alice's yeyo;
    Note over Bob's yeyo,Alice's yeyo: Bob's yeyo attempts to fetch the file from the source
    
    alt has file
        Alice's yeyo --) Bob's yeyo: here file #9829;
        Note over Alice's yeyo,Bob's yeyo: If possible, Alice's yeyo returns the file directly
    else no file
        Alice's yeyo --) Bob's yeyo: sry no yoink
        Note over Alice's yeyo,Bob's yeyo: Eventually the file would be missing
        
        Bob's yeyo ->> Storage Backend: give file
        activate Storage Backend;
        Note over Bob's yeyo,Storage Backend: Bob's yeyo then talks directly to the Storage backend
        Storage Backend --) Bob's yeyo: here file
        deactivate Storage Backend;
    end
    deactivate Alice's yeyo;
    Bob's yeyo-->>Bob: here file
    deactivate Bob's yeyo;
    deactivate Bob;

HTTP API

Storing Files

  • /yeet - Hands a file over to the service for storage and returns its ID.
    • ?file_name=... - Optional. Allows to specify name metadata for the file.

Retrieving files

  • /yoink/:id - Retrieves a file from storage, given its ID.

Metrics

  • /metrics - Produces metrics in Prometheus/OpenMetrics format.

Health Checks

  • /startupz - Meant for Kubernetes startup probes.
  • /readyz - Meant for Kubernetes readiness probes.
  • /livez - Meant for Kubernetes liveness probes.
  • /health - Meant for complete health checks (e.g. by Google Cloud Load Balancer).
  • /healthz - Meant for human inspection.

Shutdown

  • /stop - Initiates a graceful shutdown.

Dependencies

~18–30MB
~452K SLoC