-
Notifications
You must be signed in to change notification settings - Fork 18
/
storagectx.go
41 lines (32 loc) · 1.24 KB
/
storagectx.go
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
// SPDX-FileCopyrightText: 2022 SAP SE or an SAP affiliate company and Open Component Model contributors.
//
// SPDX-License-Identifier: Apache-2.0
package cpi
import (
"github.com/open-component-model/ocm/v2/pkg/contexts/ocm/internal"
)
type DefaultStorageContext struct {
ComponentRepository Repository
ComponentVersion ComponentVersionAccess
ImplementationRepositoryType ImplementationRepositoryType
}
var _ StorageContext = (*DefaultStorageContext)(nil)
func NewDefaultStorageContext(repo Repository, vers ComponentVersionAccess, reptype ImplementationRepositoryType) *DefaultStorageContext {
return &DefaultStorageContext{
ComponentRepository: repo,
ComponentVersion: vers,
ImplementationRepositoryType: reptype,
}
}
func (c *DefaultStorageContext) GetContext() internal.Context {
return c.ComponentRepository.GetContext()
}
func (c *DefaultStorageContext) TargetComponentVersion() internal.ComponentVersionAccess {
return c.ComponentVersion
}
func (c *DefaultStorageContext) TargetComponentRepository() internal.Repository {
return c.ComponentRepository
}
func (c *DefaultStorageContext) GetImplementationRepositoryType() ImplementationRepositoryType {
return c.ImplementationRepositoryType
}