**Explanation:**
1. **Temporary File Creation:** The content is first written to a temporary file (appending `.tmp` to the original path). This ensures that the original file remains intact until the write is complete.
2. **Write to Temporary File:** Using the existing `Writer` with truncation (`false`), the content is written to the temporary file. If the write fails, the temporary file is closed and deleted.
3. **Commit and Rename:** After successfully writing to the temporary file, it is committed. Then, the temporary file is atomically renamed to the target path using `Move`, which is handled by the filesystem's rename operation (atomic on most systems).
4. **Cleanup on Failure:** If any step fails, the temporary file is cleaned up to avoid leaving orphaned files.
Signed-off-by: Oded Porat <onporat@gmail.com>
Bumps the go_modules group with 1 update in the / directory: [golang.org/x/net](https://github.com/golang/net).
Updates `golang.org/x/net` from 0.37.0 to 0.38.0
- [Commits](https://github.com/golang/net/compare/v0.37.0...v0.38.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-version: 0.38.0
dependency-type: direct:production
dependency-group: go_modules
...
Signed-off-by: dependabot[bot] <support@github.com>
To address the issue where a failed write operation results in an empty file, we can use a temporary file for non-append writes. This ensures that the original file is only replaced once the new content is fully written and committed.
**Key Changes:**
1. **Temporary File Handling:**
- For non-append writes, a temporary file is created in the same directory as the target file.
- All write operations are performed on the temporary file first.
2. **Atomic Commit:**
- The temporary file is only renamed to the target path during `Commit()`, ensuring atomic replacement.
- If `Commit()` fails, the temporary file is cleaned up.
3. **Error Handling:**
- `Cancel()` properly removes temporary files if the operation is aborted.
- `Close()` is made idempotent to handle multiple calls safely.
4. **Data Integrity:**
- Directory sync after rename ensures metadata persistence.
- Proper file flushing and syncing before rename operations.
Signed-off-by: Oded Porat <onporat@gmail.com>
it can now return a client using default azure credentials
updated docs to include information on Azure Workload Identity
Signed-off-by: Lucas Melchior <lucasmelchior@flywheel.io>
fix anchor link in docs
Signed-off-by: Lucas Melchior <lucasmelchior@flywheel.io>
There was a typo and non-existent config option in the linter config.
Because we don't verify the config it's easy to miss it.
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Bumps the go_modules group with 1 update in the / directory: [golang.org/x/net](https://github.com/golang/net).
Updates `golang.org/x/net` from 0.33.0 to 0.36.0
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.36.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: direct:production
dependency-group: go_modules
...
Signed-off-by: dependabot[bot] <support@github.com>
Originally we used to have integration tests only for S3 so we decided
to call them "clooud" (tests). We've now added integration tests for
Azure storage driver so calling the S3 one cloud is just opaque and
rather confusing. This commit renamed -cloud- targets to -s3- ones.
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
* Make copy poll max retry, a global driver max retry
* Get support for etags in Azure
* Fix storage driver tests
* Fix auth mess and update docs
* Refactor Azure client and enable Azure storage tests
We use Azurite for integration testing which requires TLS,
so we had to figure out how to skip TLS verification when running tests locally:
this required updating testsuites Driver and constructor due to TestRedirectURL
sending GET and HEAD requests to remote storage which in this case is Azurite.
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>