Documentation
¶
Index ¶
- Constants
- func SmbMount(username, password, server, shareName string) error
- func SmbRemove(server, shareName string) error
- type Copier
- type CopierAlias
- type CopierFtp
- type CopierLocal
- type CopierType
- type Dir
- type FileMonitor
- func (f *FileMonitor) AddAllDirPublisher(publisher Publisher)
- func (f *FileMonitor) AddDir(dir *Dir) error
- func (f *FileMonitor) Connected() bool
- func (f *FileMonitor) GetDirs() []string
- func (f *FileMonitor) GetStats() *Stats
- func (f *FileMonitor) NewDir(name, monitorFolder, publishLocation string, monitorFreq time.Duration, ...) (*Dir, error)
- func (f *FileMonitor) RemoveDir(dir *Dir) error
- func (f *FileMonitor) Start() error
- func (f *FileMonitor) Update() error
- type MatchGroup
- type Processor
- type ProcessorExecutor
- type ProcessorType
- type Publisher
- type Stats
Constants ¶
View Source
const ( CopierTypeNull = iota CopierTypeLocal CopierTypeFTP )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Copier ¶
type Copier interface { Copy(dir, monitorDir string) error GetType() CopierType MarshalJSON() ([]byte, error) // Must inject type into object }
type CopierAlias ¶ added in v0.1.3
type CopierAlias struct { Type CopierType Details json.RawMessage }
func (*CopierAlias) GetCopier ¶ added in v0.1.3
func (c *CopierAlias) GetCopier() (Copier, error)
func (*CopierAlias) UnmarshalJSON ¶ added in v0.1.3
func (c *CopierAlias) UnmarshalJSON(data []byte) error
type CopierFtp ¶ added in v0.1.3
type CopierFtp struct { Server string Username string Password string // Does not store the password directly and only stores encrypted using the encryptionFunc Destination string EncryptionFunc func(string) (string, error) `json:"-"` // Not stored in JSON DecryptionFunc func(string) (string, error) `json:"-"` // Not stored in JSON }
func (*CopierFtp) GetType ¶ added in v0.1.3
func (c *CopierFtp) GetType() CopierType
func (*CopierFtp) MarshalJSON ¶ added in v0.1.3
type CopierLocal ¶
type CopierLocal struct {
Destination string
}
func (*CopierLocal) Copy ¶
func (c *CopierLocal) Copy(filePath, monitorDir string) error
func (*CopierLocal) GetType ¶ added in v0.1.3
func (c *CopierLocal) GetType() CopierType
func (*CopierLocal) MarshalJSON ¶ added in v0.1.3
func (c *CopierLocal) MarshalJSON() ([]byte, error)
type CopierType ¶
type CopierType int
type Dir ¶
type Dir struct { Name string MonitorFolder string MonitorFrequency time.Duration KeepEmptyDirs bool Active bool MatchGroups []MatchGroup Processor *Processor Publishers []Publisher `json:"-"` Copiers []Copier // Copier to use if an error occurs after a match as original file will be delete ErrorCopiers []Copier Stats Stats // contains filtered or unexported fields }
func (*Dir) UnmarshalJSON ¶ added in v0.1.3
type FileMonitor ¶
type FileMonitor struct { Dirs map[string]*Dir MaxJobs uint // maximum number of jobs that can be buffered without waiting NumWorkers uint // number of workers processing files // contains filtered or unexported fields }
func NewFileMonitor ¶ added in v0.0.3
func (*FileMonitor) AddAllDirPublisher ¶ added in v0.0.3
func (f *FileMonitor) AddAllDirPublisher(publisher Publisher)
func (*FileMonitor) AddDir ¶
func (f *FileMonitor) AddDir(dir *Dir) error
func (*FileMonitor) Connected ¶
func (f *FileMonitor) Connected() bool
func (*FileMonitor) GetDirs ¶
func (f *FileMonitor) GetDirs() []string
func (*FileMonitor) GetStats ¶
func (f *FileMonitor) GetStats() *Stats
func (*FileMonitor) NewDir ¶
func (f *FileMonitor) NewDir(name, monitorFolder, publishLocation string, monitorFreq time.Duration, processor *Processor, overwriteExistingDir bool, matchGroups []MatchGroup) (*Dir, error)
Creates a new dir
Likely caller will want to add Publisher, Copiers, and/or ErrorCopiers
func (*FileMonitor) RemoveDir ¶
func (f *FileMonitor) RemoveDir(dir *Dir) error
func (*FileMonitor) Start ¶
func (f *FileMonitor) Start() error
func (*FileMonitor) Update ¶
func (f *FileMonitor) Update() error
type MatchGroup ¶
type MatchGroup struct { Expression string Exclude bool // If true value must not exist. If false value must exist // contains filtered or unexported fields }
Regex matching for file to be processed
Uses dir + file name with the separator guaranteed to be "/"
type Processor ¶
type Processor struct { Type ProcessorType Executor ProcessorExecutor }
func (*Processor) UnmarshalJSON ¶
type ProcessorExecutor ¶
type ProcessorType ¶
type ProcessorType int
const ( ProcessorTypeNull ProcessorType = iota ProcessorTypeCsv )
Click to show internal directories.
Click to hide internal directories.