murphy/store/store.go

35 lines
597 B
Go
Raw Normal View History

2021-11-30 14:58:33 +01:00
package store
import (
"github.com/mehdioa/nlog"
2021-11-30 23:09:34 +01:00
"sync"
2021-11-30 14:58:33 +01:00
"time"
)
type Store struct {
2021-11-30 23:09:34 +01:00
TargetPath []string
SourcePath []string
2021-11-30 14:58:33 +01:00
GracePeriod time.Duration
2021-11-30 23:09:34 +01:00
Projects map[string]*Project
Logger *nlog.Logger
lock sync.RWMutex
2021-11-30 14:58:33 +01:00
}
2021-11-30 23:09:34 +01:00
type Project struct {
TargetPath string
LastChange time.Time
Created time.Time
ProjectName string
Logger *nlog.Node
}
func NewStore(Logger *nlog.Logger) *Store {
store := &Store{Logger: Logger, Projects: make(map[string]*Project)}
2021-11-30 14:58:33 +01:00
return store
}
2021-11-30 23:09:34 +01:00
func (store *Store) GetProjects() map[string]*Project {
return store.Projects
}