-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: veilid-hacks action: blob revision: path_from: veilid-table-set revision_from: refs/heads/trunk: path_to: revision_to:
/ veilid-table-set
refs/heads/trunk:/veilid-table-set #!/usr/bin/env bash if [ ! "$1" ];then printf 'usage: veilid-table-set <table> <key> <value>\n' >&2 printf 'key does NOT mean a crypto key. just a name like in key:value store\n' >&2 printf 'table can be any name you want. if the table doesnt exist, it is created.\n' >&2 exit 1 fi if [ "$1" != "socat" ];then export table="$1" export key="$2" export value="$(printf "%s" "$3" | enb64url)" exec socat "tcp:${VEILID_SERVER:-127.0.0.1:5959}" "exec:$0 socat" 2>&1 else shift fi printf '{"op":"OpenTableDb","name":"%s","column_count":1}\n' "${table}" state=0 stdbuf -oL jq -nc 'inputs | select(.type != "Update")' | while read -r line;do printf 'line: %s\n' "$line" >&2 case "$state" in 0) db_id="$(jq -r .value <<< "${line}")" printf '{"op":"TableDb","db_id":%d,"db_op":"Store","col":0,"key":"%s","value":"%s"}\n' "${db_id}" "${key}" "${value}" ;; 1) printf '{"op":"TableDb","db_id":%d,"db_op":"Release"}\n' "${db_id}" ;; 2) printf '\nQUIT :what? this isnt woodshop?\r\n' ;; *) echo 'state: ' "$state" >&2 ;; esac state=$[$state+1] done | tee /dev/stderr
-- Response ended
-- Page fetched on Sun Jun 2 12:55:49 2024