mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
This adds support for storing packages directly on Azure, with no truly "local" (on-disk) repo used. The existing Azure PublishedStorage implementation was refactored to move the shared code to a separate context struct, which can then be re-used by the new PackagePool. In addition, the files package's mockChecksumStorage was made public so that it could be used in the Azure PackagePool tests as well. Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
37 lines
725 B
Go
37 lines
725 B
Go
package files
|
|
|
|
import (
|
|
"github.com/aptly-dev/aptly/aptly"
|
|
"github.com/aptly-dev/aptly/utils"
|
|
)
|
|
|
|
type MockChecksumStorage struct {
|
|
Store map[string]utils.ChecksumInfo
|
|
}
|
|
|
|
// NewMockChecksumStorage creates aptly.ChecksumStorage for tests
|
|
func NewMockChecksumStorage() aptly.ChecksumStorage {
|
|
return &MockChecksumStorage{
|
|
Store: make(map[string]utils.ChecksumInfo),
|
|
}
|
|
}
|
|
|
|
func (st *MockChecksumStorage) Get(path string) (*utils.ChecksumInfo, error) {
|
|
c, ok := st.Store[path]
|
|
if !ok {
|
|
return nil, nil
|
|
}
|
|
|
|
return &c, nil
|
|
}
|
|
|
|
func (st *MockChecksumStorage) Update(path string, c *utils.ChecksumInfo) error {
|
|
st.Store[path] = *c
|
|
return nil
|
|
}
|
|
|
|
// Check interface
|
|
var (
|
|
_ aptly.ChecksumStorage = &MockChecksumStorage{}
|
|
)
|