Commit 733a117
authored
feat!(catalog-managed): New copy_atomic StorageHandler method (delta-io#1400)
## What changes are proposed in this pull request?
Adds a new required method: `copy_atomic(&self, src: &Url, dest: &Url)
-> DeltaResult<()>` to `StorageHandler`. This PR also adds support for
the default engine via the (dumb) way of GET/PUT. Note that I've elected
to pursue the simple/correct thing here and we can attempt to optimize
in the future (and can open a follow-up if others agree).
~This implementation proposes a slight departure from existing `Engine`
APIs: instead of returning a `DeltaResult<()>` we return `Result<(),
CopyError>` with CopyError defined as:~
<details>
<summary>old pieces on CopyError omitted</summary>
```rust
#[derive(thiserror::Error, Debug)]
pub enum CopyError {
#[error("Destination file already exists: {0}")]
DestinationAlreadyExists(String),
#[error(transparent)]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}
```
It captures the only things we care about from the `copy` API
perspective: either the destination already exists and we can return a
nice error message to the user saying their commit has already been
published (considering publishing is the main use case of this API for
now) _or_ we just got back some other random error which we don't really
care what it is, but rather just something we can surface to the user
and fail the overall publish API.
I've used this PR as an opportunity to introduce an Engine API more
aligned with our pursuit of finer-grainer errors (especially for Engine
trait) but happy to split out if we think it's better to just retain
existing `DeltaResult` pattern.
</details>
### Motivation
This PR will be used for commit publishing - basically copying commits
from staged commits to published commits. See delta-io#1377 for some context on
future usage.
### This PR affects the following public APIs
New required method in `StorageHandler` trait: `copy_atomic`
## How was this change tested?
new UT for default engine impl1 parent 09a82a3 commit 733a117
File tree
4 files changed
+69
-1
lines changed- kernel/src
- engine
- default
- sync
4 files changed
+69
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
178 | 203 | | |
179 | 204 | | |
180 | 205 | | |
| |||
300 | 325 | | |
301 | 326 | | |
302 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
303 | 360 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
637 | 640 | | |
638 | 641 | | |
639 | 642 | | |
| |||
0 commit comments