link: allow creating public link to files and folders - closes #1562
This commit is contained in:
parent
9df266a6b4
commit
a8267d1628
31 changed files with 275 additions and 41 deletions
12
fs/fs.go
12
fs/fs.go
|
@ -328,6 +328,9 @@ type Features struct {
|
|||
// as an optional interface
|
||||
DirCacheFlush func()
|
||||
|
||||
// PublicLink generates a public link to the remote path (usually readable by anyone)
|
||||
PublicLink func(remote string) (string, error)
|
||||
|
||||
// Put in to the remote path with the modTime given of the given size
|
||||
//
|
||||
// May create the object even if it returns an error - if so
|
||||
|
@ -443,6 +446,9 @@ func (ft *Features) Fill(f Fs) *Features {
|
|||
if do, ok := f.(DirCacheFlusher); ok {
|
||||
ft.DirCacheFlush = do.DirCacheFlush
|
||||
}
|
||||
if do, ok := f.(PublicLinker); ok {
|
||||
ft.PublicLink = do.PublicLink
|
||||
}
|
||||
if do, ok := f.(PutUncheckeder); ok {
|
||||
ft.PutUnchecked = do.PutUnchecked
|
||||
}
|
||||
|
@ -642,6 +648,12 @@ type PutStreamer interface {
|
|||
PutStream(in io.Reader, src ObjectInfo, options ...OpenOption) (Object, error)
|
||||
}
|
||||
|
||||
// PublicLinker is an optional interface for Fs
|
||||
type PublicLinker interface {
|
||||
// PublicLink generates a public link to the remote path (usually readable by anyone)
|
||||
PublicLink(remote string) (string, error)
|
||||
}
|
||||
|
||||
// MergeDirser is an option interface for Fs
|
||||
type MergeDirser interface {
|
||||
// MergeDirs merges the contents of all the directories passed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue