diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-08-16 12:05:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 12:05:15 +0800 |
commit | 1f146090ecbd9876ed41ddccc4d05ee1bedbb48e (patch) | |
tree | 04a4f06ff8f9976f6dc8814a30585cc5b41247bf /modules/packages/content_store.go | |
parent | 86c85c19b625e6ddd99f220a13ee3b5c4cc398e1 (diff) | |
download | gitea-1f146090ecbd9876ed41ddccc4d05ee1bedbb48e.tar.gz gitea-1f146090ecbd9876ed41ddccc4d05ee1bedbb48e.zip |
Add migrate repo archiver and packages storage support on command line (#20757)
* Add migrate repo archiver and packages storage support on command line
* Fix typo
* Use stdCtx
* Use packageblob and fix command description
* Add migrate packages unit tests
* Fix comment year
* Fix the migrate storage command line description
* Update cmd/migrate_storage.go
Co-authored-by: zeripath <art27@cantab.net>
* Update cmd/migrate_storage.go
Co-authored-by: zeripath <art27@cantab.net>
* Update cmd/migrate_storage.go
Co-authored-by: zeripath <art27@cantab.net>
* Fix test
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules/packages/content_store.go')
-rw-r--r-- | modules/packages/content_store.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/packages/content_store.go b/modules/packages/content_store.go index 64c3eedc23..a3a5d1a666 100644 --- a/modules/packages/content_store.go +++ b/modules/packages/content_store.go @@ -27,21 +27,21 @@ func NewContentStore() *ContentStore { // Get gets a package blob func (s *ContentStore) Get(key BlobHash256Key) (storage.Object, error) { - return s.store.Open(keyToRelativePath(key)) + return s.store.Open(KeyToRelativePath(key)) } // Save stores a package blob func (s *ContentStore) Save(key BlobHash256Key, r io.Reader, size int64) error { - _, err := s.store.Save(keyToRelativePath(key), r, size) + _, err := s.store.Save(KeyToRelativePath(key), r, size) return err } // Delete deletes a package blob func (s *ContentStore) Delete(key BlobHash256Key) error { - return s.store.Delete(keyToRelativePath(key)) + return s.store.Delete(KeyToRelativePath(key)) } -// keyToRelativePath converts the sha256 key aabb000000... to aa/bb/aabb000000... -func keyToRelativePath(key BlobHash256Key) string { +// KeyToRelativePath converts the sha256 key aabb000000... to aa/bb/aabb000000... +func KeyToRelativePath(key BlobHash256Key) string { return path.Join(string(key)[0:2], string(key)[2:4], string(key)) } |