Commit 7097fd8
feat: Adds a new raw file metadata storage for clients (#347)
* Added first draft for a raw json local file storage.
Signed-off-by: Fredrik Skogman <[email protected]>
* Ignore emacs temporary files
Signed-off-by: Fredrik Skogman <[email protected]>
* moved isMetaFile to util directory for reuse in other packages.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added unit tests and refactored code to match the local store for repository
side.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added test case for non json file in metadata directory.
Changed package to client to align with leveldb storage.
Signed-off-by: Fredrik Skogman <[email protected]>
* Use os.MkdirAll when creating metadata cache.
Signed-off-by: Fredrik Skogman <[email protected]>
* More consistent naming, added comments and a unit test.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added a localstore wrapper for concurrent access.
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore_test.go
Fixed spelling error found during review.
Co-authored-by: Joshua Lock <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Added tests to make sure returned struct implements LocalStore interface.
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore_test.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore_test.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Made FileJSONStore safe for concurrent access.
Moved IsMetaFile to new pkg, internal/fsutil
Permission bits are validated when access the cache.
Signed-off-by: Fredrik Skogman <[email protected]>
* Spelling error.
Signed-off-by: Fredrik Skogman <[email protected]>
* Updates based on PR comments.
Removed a test for satisfying an interface, and replaced with a compile time
check.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added first draft for a raw json local file storage.
Signed-off-by: Fredrik Skogman <[email protected]>
* Ignore emacs temporary files
Signed-off-by: Fredrik Skogman <[email protected]>
* moved isMetaFile to util directory for reuse in other packages.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added unit tests and refactored code to match the local store for repository
side.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added test case for non json file in metadata directory.
Changed package to client to align with leveldb storage.
Signed-off-by: Fredrik Skogman <[email protected]>
* Use os.MkdirAll when creating metadata cache.
Signed-off-by: Fredrik Skogman <[email protected]>
* More consistent naming, added comments and a unit test.
Signed-off-by: Fredrik Skogman <[email protected]>
* Added a localstore wrapper for concurrent access.
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore_test.go
Fixed spelling error found during review.
Co-authored-by: Joshua Lock <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Added tests to make sure returned struct implements LocalStore interface.
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore_test.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Update client/filejsonstore/filejsonstore_test.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Made FileJSONStore safe for concurrent access.
Moved IsMetaFile to new pkg, internal/fsutil
Permission bits are validated when access the cache.
Signed-off-by: Fredrik Skogman <[email protected]>
* Spelling error.
Signed-off-by: Fredrik Skogman <[email protected]>
* Updates based on PR comments.
Removed a test for satisfying an interface, and replaced with a compile time
check.
Signed-off-by: Fredrik Skogman <[email protected]>
* Disabled filesystem permission checks for windows.
Windows filesystem permission is a bit different from UNIX like systems, and
there is no good API in go to manipulate it. Nor is having these checks a
requirement by the TUF spec.
This commit relies on build tags to inject the correct filesystem permssion
check, the Windows version always return "satisfied".
Signed-off-by: Fredrik Skogman <[email protected]>
* Moved the tests that rely on permission bits to a new test file.
The permission bits are not executed during windows builds.
Signed-off-by: Fredrik Skogman <[email protected]>
* Clarify permissions check naming and comment, add tests
Signed-off-by: Ethan Lowman <[email protected]>
* Update internal/fsutil/fsutil.go
Co-authored-by: Ethan Lowman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
* Updates based on feeback.
Mostly minor things like removing sentinel errors, wrapping errors from std
library.
Signed-off-by: Fredrik Skogman <[email protected]>
* Use fs.ErrNotExist instead of os.ErrNotExist as recommended by Go docs
Signed-off-by: Ethan Lowman <[email protected]>
* Clean up remaining unnecessary usage of filepath.FromSlash
Signed-off-by: Ethan Lowman <[email protected]>
* Add missing error checks in tests
Signed-off-by: Ethan Lowman <[email protected]>
* Make sure to test that returned err is nil in the tests.
Signed-off-by: Fredrik Skogman <[email protected]>
Signed-off-by: Fredrik Skogman <[email protected]>
Signed-off-by: Ethan Lowman <[email protected]>
Co-authored-by: Joshua Lock <[email protected]>
Co-authored-by: Ethan Lowman <[email protected]>
Co-authored-by: Ethan Lowman <[email protected]>1 parent a9ddd89 commit 7097fd8
File tree
9 files changed
+541
-15
lines changed- client/filejsonstore
- internal/fsutil
9 files changed
+541
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
0 commit comments