From dc3deab00741d372f240156c501c72b41d173ad4 Mon Sep 17 00:00:00 2001 From: Katarzyna Gorska Date: Thu, 9 Nov 2017 10:37:06 +0100 Subject: [PATCH] Add Storage and stubs for interface implementation Storage implements ArtifactManager interface. Also ArtifactDownloader method Download parameters changed. To properly download an artifact, we should pass not only ArtifactURI, but also ArtifactPath. Close method was added to ArtifactDownloader. Change-Id: Ic707ee270cfd54d2f0bb9792d1b5f65ceae75e80 Signed-off-by: Katarzyna Gorska --- artifacts/artifacts.go | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/artifacts/artifacts.go b/artifacts/artifacts.go index fcae9ec..40b398f 100644 --- a/artifacts/artifacts.go +++ b/artifacts/artifacts.go @@ -24,8 +24,38 @@ import ( // ArtifactDownloader downloads requested file if there is need to. type ArtifactDownloader interface { // Download starts downloading requested artifact. - Download(URI ArtifactURI) (ArtifactInfo, error) + Download(URI ArtifactURI, path ArtifactPath, ch chan ArtifactStatusChange) error // CheckInCache checks if file already exists in ArtifactDB. CheckInCache(URI ArtifactURI) (ArtifactInfo, error) + + // Close waits for all jobs to finish, and gracefully closes ArtifactDownloader. + Close() +} + +// Storage should be used by Weles' subsystems that need access to ArtifactDB +// or information about artifacts stored there. +// Storage implements ArtifactManager interface. +type Storage struct { + ArtifactManager +} + +// ListArtifact is part of implementation of ArtifactManager interface. +func (s *Storage) ListArtifact(filter ArtifactFilter) ([]ArtifactInfo, error) { + return nil, ErrNotImplemented +} + +// PushArtifact is part of implementation of ArtifactManager interface. +func (s *Storage) PushArtifact(artifact ArtifactDescription, ch chan ArtifactStatusChange) (ArtifactPath, error) { + return "", ErrNotImplemented +} + +// CreateArtifact is part of implementation of ArtifactManager interface. +func (s *Storage) CreateArtifact(artifact ArtifactDescription) (ArtifactPath, error) { + return "", ErrNotImplemented +} + +// GetArtifactInfo is part of implementation of ArtifactManager interface. +func (s *Storage) GetArtifactInfo(path ArtifactPath) (ArtifactInfo, error) { + return ArtifactInfo{}, ErrNotImplemented } -- 2.7.4