mirror of https://github.com/curusarn/resh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
905 B
43 lines
905 B
package histio
|
|
|
|
import (
|
|
"path"
|
|
|
|
"github.com/curusarn/resh/record"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type Histio struct {
|
|
sugar *zap.SugaredLogger
|
|
histDir string
|
|
|
|
thisDeviceID string
|
|
thisHistory *histfile
|
|
// TODO: remote histories
|
|
// moreHistories map[string]*histfile
|
|
|
|
recordsToAppend chan record.V1
|
|
// recordsToFlag chan recordint.Flag
|
|
}
|
|
|
|
func New(sugar *zap.SugaredLogger, dataDir, deviceID string) *Histio {
|
|
sugarHistio := sugar.With(zap.String("component", "histio"))
|
|
histDir := path.Join(dataDir, "history")
|
|
currPath := path.Join(histDir, deviceID)
|
|
// TODO: file extenstion for the history, yes or no? (<id>.reshjson vs. <id>)
|
|
|
|
// TODO: discover other history files, exclude current
|
|
|
|
return &Histio{
|
|
sugar: sugarHistio,
|
|
histDir: histDir,
|
|
|
|
thisDeviceID: deviceID,
|
|
thisHistory: newHistfile(sugar, currPath),
|
|
// moreHistories: ...
|
|
}
|
|
}
|
|
|
|
func (h *Histio) Append(r *record.V1) {
|
|
|
|
}
|
|
|