This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

ipfs.lassul.us: pin service only calculates hash, never pins

+14 -5
+14 -5
2configs/services/flix/ipfs_upload.py
··· 12 12 POST /<path> body=N bytes, Content-Range: bytes <start>-<end>/<total> 13 13 Chunked upload. `start` must equal the current staging size, or 0 14 14 to truncate and start fresh. When the staging size reaches `total`, 15 - the staging file is moved to /var/lib/ipfs/download/<path> and 16 - `ipfs add --nocopy --pin` is run. Returns 200 with the CID on 17 - completion, 308 with `Upload-Offset: <size>` while incomplete. 15 + the staging file is moved to /var/lib/ipfs/download/<path>; the 16 + ipfs-pin-watcher then pins it (it is the sole pinner). This handler 17 + only computes the CID (`ipfs add --only-hash`) to return. Returns 200 18 + with the CID on completion, 308 with `Upload-Offset: <size>` while 19 + incomplete. 18 20 19 21 POST /<path> body=0, no Content-Range 20 22 Status check. Returns 200 with `Upload-Offset: <size>` if a ··· 202 204 self.send_error(500, f"truncate failed: {e}") 203 205 return 204 206 205 - # Complete: move staging → dst and pin. 207 + # Complete: move staging → dst. The os.replace() below fires the 208 + # ipfs-pin-watcher's inotify MOVED_TO, and the watcher is the SOLE 209 + # pinner (`ipfs add --nocopy --pin`). We must NOT also pin here: two 210 + # concurrent `--nocopy` adds of the same file corrupt the filestore 211 + # into an incomplete DAG. So we only compute the CID to return to the 212 + # client (--only-hash writes nothing). The watcher's single-threaded 213 + # loop is then the only thing mutating the filestore. Pinning is 214 + # therefore async — the watcher finishes a beat after this returns. 206 215 dst = os.path.join(DOWNLOAD_ROOT, rel) 207 216 dst_dir = os.path.dirname(dst) or DOWNLOAD_ROOT 208 217 try: ··· 214 223 215 224 try: 216 225 result = subprocess.run( 217 - [IPFS_BIN, "add", "--nocopy", "--pin", "--quieter", dst], 226 + [IPFS_BIN, "add", "--only-hash", "--raw-leaves", "--quieter", dst], 218 227 check=True, 219 228 capture_output=True, 220 229 text=True,