Documentation ¶
Overview ¶
Package fs inclues a filesystem that can read from a local directory or S3.
Index ¶
- func Copy(ctx context.Context, input *CopyInput) error
- func EqualTimestamp(a time.Time, b time.Time, d time.Duration) bool
- func Sync(ctx context.Context, input *SyncInput) (int, error)
- func SyncDirectory(ctx context.Context, input *SyncDirectoryInput) (int, error)
- type CopyInput
- type DirectoryEntry
- type DirectoryEntryInterface
- type File
- type FileInfo
- type FileSystem
- type Logger
- type Object
- type SyncDirectoryInput
- type SyncInput
- type Writer
- type WriterAt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EqualTimestamp ¶
EqualTimestamp returns true if time a and b are equal after being truncated. When syncing between a source and destination filesystem with different precision for their last modified timestamps, this function can be used to confirm the stored timestamps are equivalent.
func SyncDirectory ¶
func SyncDirectory(ctx context.Context, input *SyncDirectoryInput) (int, error)
Types ¶
type CopyInput ¶
type CopyInput struct { CheckParents bool SourceName string SourceFileInfo FileInfo SourceFileSystem FileSystem DestinationName string DestinationFileInfo FileInfo DestinationFileSystem FileSystem Logger Logger MakeParents bool }
type DirectoryEntry ¶
type DirectoryEntry struct {
// contains filtered or unexported fields
}
func NewDirectoryEntry ¶
func (*DirectoryEntry) IsDir ¶
func (de *DirectoryEntry) IsDir() bool
func (*DirectoryEntry) MarshalJSON ¶
func (de *DirectoryEntry) MarshalJSON() ([]byte, error)
func (*DirectoryEntry) ModTime ¶
func (de *DirectoryEntry) ModTime() time.Time
func (*DirectoryEntry) Name ¶
func (de *DirectoryEntry) Name() string
func (*DirectoryEntry) Size ¶
func (de *DirectoryEntry) Size() int64
func (*DirectoryEntry) String ¶
func (de *DirectoryEntry) String() string
type DirectoryEntryInterface ¶
type FileSystem ¶
type FileSystem interface { Chtimes(ctx context.Context, name string, atime time.Time, mtime time.Time) error Copy(ctx context.Context, input *CopyInput) error Dir(name string) string IsNotExist(err error) bool Join(name ...string) string MagicNumber(ctx context.Context, name string) ([]byte, error) MagicNumbers(ctx context.Context, names []string, threads int) ([][]byte, error) MkdirAll(ctx context.Context, name string, mode os.FileMode) error MustRelative(ctx context.Context, basepath string, targetpath string) string Open(ctx context.Context, name string) (Object, error) OpenObject(ctx context.Context, name string, flag int, perm os.FileMode) (Object, error) Relative(ctx context.Context, basepath string, targetpath string) (string, error) ReadDir(ctx context.Context, name string, recursive bool) ([]DirectoryEntryInterface, error) ReadFile(ctx context.Context, name string, p []byte) (n int, err error) // open up a file and read the contents RemoveFile(ctx context.Context, name string) error RemoveFiles(ctx context.Context, names []string) error RemoveDirectory(ctx context.Context, name string, recursive bool) error RemoveDirectories(ctx context.Context, name []string, recursive bool) error Root() string Size(ctx context.Context, name string) (int64, error) Stat(ctx context.Context, name string) (FileInfo, error) Sync(ctx context.Context, input *SyncInput) (int, error) SyncDirectory(ctx context.Context, input *SyncDirectoryInput) (int, error) }
type Object ¶
type Object interface { io.ReadSeekCloser io.WriteCloser Name() string WriteTo(ctx context.Context, w Writer) (int64, error) }
type SyncDirectoryInput ¶
type SyncInput ¶
type SyncInput struct { Delete bool Source string // could be file or directory SourceFileSystem FileSystem Destination string // could be file or directory Exclude []string DestinationFileSystem FileSystem Parents bool CheckTimestamps bool Limit int Logger Logger MaxThreads int TimestampPrecision time.Duration }
type Writer ¶
type Writer interface { io.WriteCloser }
Click to show internal directories.
Click to hide internal directories.