37 lines
773 B
Go
37 lines
773 B
Go
package store
|
|
|
|
import (
|
|
"github.com/go-co-op/gocron"
|
|
"github.com/mehdioa/nlog"
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
type Store struct {
|
|
TargetPath []string
|
|
SourcePath []string
|
|
GracePeriod time.Duration
|
|
Projects map[string]*Project
|
|
Logger *nlog.Logger
|
|
Scheduler *gocron.Scheduler
|
|
lock sync.RWMutex
|
|
}
|
|
|
|
type Project struct {
|
|
TargetPath string
|
|
LastChange time.Time
|
|
Created time.Time
|
|
ProjectName string
|
|
ShouldMove bool
|
|
Logger *nlog.Node
|
|
}
|
|
|
|
func NewStore(Logger *nlog.Logger, sourcePath []string, gracePeriod time.Duration) *Store {
|
|
store := &Store{Logger: Logger, Projects: make(map[string]*Project), SourcePath: sourcePath, GracePeriod: gracePeriod}
|
|
return store
|
|
}
|
|
|
|
func (store *Store) GetProjects() map[string]*Project {
|
|
return store.Projects
|
|
}
|