MCPcopy Create free account
hub / github.com/aptly-dev/aptly / NewPublishedStorage

Function NewPublishedStorage

files/public.go:49–71  ·  view source on GitHub ↗

NewPublishedStorage creates new instance of PublishedStorage which specified root

(root string, linkMethod string, verifyMethod string)

Source from the content-addressed store, hash-verified

47
48// NewPublishedStorage creates new instance of PublishedStorage which specified root
49func NewPublishedStorage(root string, linkMethod string, verifyMethod string) *PublishedStorage {
50 // Ensure linkMethod is one of 'hardlink', 'symlink', 'copy'
51 var verifiedLinkMethod uint
52
53 if strings.EqualFold(linkMethod, "copy") {
54 verifiedLinkMethod = LinkMethodCopy
55 } else if strings.EqualFold(linkMethod, "symlink") {
56 verifiedLinkMethod = LinkMethodSymLink
57 } else {
58 verifiedLinkMethod = LinkMethodHardLink
59 }
60
61 var verifiedVerifyMethod uint
62
63 if strings.EqualFold(verifyMethod, "size") {
64 verifiedVerifyMethod = VerificationMethodFileSize
65 } else {
66 verifiedVerifyMethod = VerificationMethodChecksum
67 }
68
69 return &PublishedStorage{rootPath: root, linkMethod: verifiedLinkMethod,
70 verifyMethod: verifiedVerifyMethod}
71}
72
73// PublicPath returns root of public part
74func (storage *PublishedStorage) PublicPath() string {

Callers 15

SetUpTestMethod · 0.92
TestMultiDistPoolMethod · 0.92
SetUpTestMethod · 0.92
TestLinkFromPoolMethod · 0.92
GetPublishedStorageMethod · 0.92
SetUpTestMethod · 0.70
TestRootRemoveMethod · 0.70
TestPutFileOutOfSpaceMethod · 0.70
TestSyncIsCalledMethod · 0.70

Calls

no outgoing calls

Tested by 15

SetUpTestMethod · 0.74
TestMultiDistPoolMethod · 0.74
SetUpTestMethod · 0.74
TestLinkFromPoolMethod · 0.74
SetUpTestMethod · 0.56
TestRootRemoveMethod · 0.56
TestPutFileOutOfSpaceMethod · 0.56
TestSyncIsCalledMethod · 0.56