Until support exists for more storage systems, the only options for using Rome are S3 and the local cache. For security and other reasons, we can't easily use S3 with our current setup. I propose that Rome adds support for synchronizing using a custom script or executable with a well-defined interface. A status code of 0 would indicate success and standardized error codes could indicate other statuses (file not found, etc). This way, people can plug in the script to add support for whatever storage system they want no matter how bespoke or esoteric it may be:
Supply custom-exec option in Romefile
[Cache]
local = ~/Library/Caches/Rome
custom-exec = ./my-custom-sync-script.sh
rome executes the script to handle actions
# upload to remote
./my-custom-sync-script.sh upload <local-path> <remote-path>
# download from remote
./my-custom-sync-script.sh download <remote-path> <local-path>
# probe remote for existence of file
./my-custom-sync-script.sh probe <remote-path>
Trivial example of a custom HTTP sync script
#!/bin/bash
set -e
ACTION="$1"
BASE_URL="http://my.server.internal/rome_cache"
if [ "$ACTION" == "upload" ]; then
# make PUT request to save file on remote
LOCAL_PATH="$2"
REMOTE_PATH="$3"
curl -sf -X PUT "$BASE_URL$REMOTE_PATH" -d "@$LOCAL_PATH"
elif [ "$ACTION" == "download" ]; then
# make GET request for file, save to specified output path
REMOTE_PATH="$2"
OUTPUT_PATH="$3"
curl -sf "$BASE_URL$REMOTE_PATH" -o "$OUTPUT_PATH"
elif [ "$ACTION" == "probe" ]; then
# make HEAD request to check for existence of file
REMOTE_PATH="$2"
curl -sfI "$BASE_URL$REMOTE_PATH" > /dev/null
else
# unsupported command
exit 1
fi
Until support exists for more storage systems, the only options for using Rome are S3 and the local cache. For security and other reasons, we can't easily use S3 with our current setup. I propose that Rome adds support for synchronizing using a custom script or executable with a well-defined interface. A status code of
0would indicate success and standardized error codes could indicate other statuses (file not found, etc). This way, people can plug in the script to add support for whatever storage system they want no matter how bespoke or esoteric it may be:Supply
custom-execoption inRomefileromeexecutes the script to handle actionsTrivial example of a custom HTTP sync script