From 0cac84dc3d7c3b79c3ebe0d369714702191ea90f Mon Sep 17 00:00:00 2001 From: Robert van Gent Date: Thu, 3 Aug 2023 17:02:02 +0000 Subject: [PATCH] blob/fileblob: Add docstring about tempdirs --- blob/fileblob/fileblob.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blob/fileblob/fileblob.go b/blob/fileblob/fileblob.go index 47a6048e2b..880a41dd56 100644 --- a/blob/fileblob/fileblob.go +++ b/blob/fileblob/fileblob.go @@ -15,6 +15,16 @@ // Package fileblob provides a blob implementation that uses the filesystem. // Use OpenBucket to construct a *blob.Bucket. // +// To avoid partial writes, fileblob writes to a temporary file and then renames +// the temporary file to the final path on Close. By default, it creates these +// temporary files in `os.TempDir`. If `os.TempDir` is on a different mount than +// your base bucket path, the `os.Rename` will fail with `invalid cross-device link`. +// To avoid this, either: +// a) Configure the temp dir to use by setting the environment variable `TMPDIR`. +// b) Set `Options.NoTempDir` to `true`; fileblob will create the temporary files +// next to the actual files instead of in a temporary directory. Note that +// this may result in stranded temporary files. +// // By default fileblob stores blob metadata in 'sidecar files' under the original // filename but an additional ".attrs" suffix. // That behaviour can be changed via Options.Metadata;