Commit 89f2ad7
authored
Refactor dav: Adopt two-layer architecture to match other storage providers (#98)
* refactor(dav): Adopt two-layer architecture to match other storage providers
Restructure the DAV client to align with S3, Azure, GCS, and AliOSS provider
patterns in storage-cli. This is the first step in modernizing the DAV
implementation, with advanced features to follow in subsequent PRs.
**Structural Changes:**
- Split client into two layers:
- `client.go`: High-level DavBlobstore implementing storage.Storager
- `storage_client.go`: Low-level StorageClient for HTTP/WebDAV operations
- Remove cmd/ and app/ layers (now integrated directly via storage/factory.go)
- Remove test_assets/ directory (replaced by Docker-based testing)
- Remove old fakes/fake_client.go (replaced by clientfakes/fake_storage_client.go)
- Add helpers.go for shared utilities (getCertPool)
**Stub Methods (to be implemented in follow-up PRs):**
- List: List blobs with optional prefix filter
- Copy: Server-side blob copying via WebDAV COPY
- DeleteRecursive: Delete all blobs matching prefix
- Properties: Retrieve blob metadata
- EnsureStorageExists: Initialize WebDAV directory structure
**Path Handling:**
- Remove automatic 2-character path fan-out. Previously "abcdef..." was stored
as "ab/cd/abcdef...". Now object IDs are passed through unchanged.
- This aligns with other storage-cli providers (S3/Azure/GCS/AliOSS) and
matches existing CCNG usage (BaseClient#partitioned_key already handles
partitioning before calling storage-cli).
- Callers are responsible for any path layout or partitioning strategy.
**Testing:**
- Update tests to use mocked StorageClient with counterfeiter
- Add comprehensive test coverage for Exists (found, not found, error cases)
- Add docker-compose.yml for local WebDAV testing
- Update README with breaking change notice and usage examples
**Code Quality:**
- Align logging style with other providers (lowercase, Debug for success messages)
- All linter checks pass (golangci-lint, go vet, gofmt)
- 100% test pass rate
**Breaking Changes:**
- Removed automatic path partitioning. Object IDs are used exactly as provided.
- Callers must include any desired directory structure in the object ID.
- See dav/README.md "Path Handling Contract" section for migration guidance.
* Update readme
* change log level1 parent 4ee94c5 commit 89f2ad7
33 files changed
Lines changed: 843 additions & 1853 deletions
File tree
- dav
- app
- client
- clientfakes
- fakes
- cmd
- testing
- test_assets
- storage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
9 | 21 | | |
10 | 22 | | |
11 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
12 | 39 | | |
13 | 40 | | |
14 | 41 | | |
15 | | - | |
16 | | - | |
| 42 | + | |
| 43 | + | |
17 | 44 | | |
18 | | - | |
19 | | - | |
| 45 | + | |
| 46 | + | |
20 | 47 | | |
21 | | - | |
22 | | - | |
| 48 | + | |
| 49 | + | |
23 | 50 | | |
24 | | - | |
25 | | - | |
| 51 | + | |
| 52 | + | |
26 | 53 | | |
27 | | - | |
28 | | - | |
| 54 | + | |
| 55 | + | |
29 | 56 | | |
30 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
31 | 81 | | |
32 | 82 | | |
33 | 83 | | |
| |||
44 | 94 | | |
45 | 95 | | |
46 | 96 | | |
| 97 | + | |
47 | 98 | | |
48 | | - | |
| 99 | + | |
49 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments