function blob-files-dir
    if [ $RAILS_ENV = "production" ]
        echo "/mnt/blob_files_production/v1"
        return 0
    else if [ $RAILS_ENV = "development" ]
        echo "/mnt/blob_files_development/v1"
        return 0
    else
        echo "unknown RAILS_ENV: $RAILS_ENV" >&2
        return 1
    end
end

function blob-file-path
    set -l file_name $argv[1]
    set -l prefix (blob-files-dir || return 1)
    set -l p0 (string sub      -l 2 $file_name)
    set -l p1 (string sub -s 3 -l 2 $file_name)
    set -l p2 (string sub -s 5 -l 1 $file_name)
    printf "%s/%s/%s/%s/%s" $prefix $p0 $p1 $p2 $file_name
end

function blob-files-stats
    set -l files_dir (blob-files-dir || return 1)
    printf "apparent size: %s\n" (du -sh --apparent-size $files_dir)
    printf "actual size:   %s\n" (du -sh $files_dir)
end