NewPublishedStorage creates new instance of PublishedStorage which specified root
(root string, linkMethod string, verifyMethod string)
| 47 | |
| 48 | // NewPublishedStorage creates new instance of PublishedStorage which specified root |
| 49 | func 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 |
| 74 | func (storage *PublishedStorage) PublicPath() string { |
no outgoing calls