carbon/grace.go
func (app *App) RestoreFromFile(filename string, storeFunc func(*points.Points)) error {
	var pointsCount int
	startTime := time.Now()

	logger := zapwriter.Logger("restore").With(zap.String("filename", filename))
	logger.Info("restore started")

	defer func() {
		logger.Info("restore finished",
			zap.Int("points", pointsCount),
			zap.Duration("runtime", time.Since(startTime)),
		)
	}()

	err := points.ReadFromFile(filename, func(p *points.Points) {
		pointsCount += len(p.Data)
		storeFunc(p)
	})

	return err
}
func (app *App) RestoreFromFile(filename string, storeFunc func(*points.Points)) error {
	var pointsCount int
	startTime := time.Now()

	logger := zapwriter.Logger("restore").With(zap.String("filename", filename))
	logger.Info("restore started")

	defer func() {
		logger.Info("restore finished",
			zap.Int("points", pointsCount),
			zap.Duration("runtime", time.Since(startTime)),
		)
	}()

	err := points.ReadFromFile(filename, func(p *points.Points) {
		pointsCount += len(p.Data)
		storeFunc(p)
	})

	return err
}
func ( app * App ) RestoreFromFile ( filename string , storeFunc func ( * points . Points ) ) error { var pointsCount int startTime := time . Now ( ) logger := zapwriter . Logger ( " " ) . With ( zap . String ( " " , filename ) ) logger . Info ( " " ) defer func ( ) { logger . Info ( " " , zap . Int ( " " , pointsCount ) , zap . Duration ( " " , time . Since ( startTime ) ) , ) } ( ) err := points . ReadFromFile ( filename , func ( p * points . Points ) { pointsCount += len ( p . Data ) storeFunc ( p ) } ) return err }
// RestoreFromFile read and parse data from single file
RestoreFromFile read and parse data from single file