~chrisppy/beagles

013c74832323d8b0b831c4c3d8e2383986fa8f26 — Chris Palmer 24 days ago 81a8dad
Finish restore
1 files changed, 4 insertions(+), 3 deletions(-)

M db/db.go
M db/db.go => db/db.go +4 -3
@@ 20,6 20,7 @@ package db
import (
	"fmt"
	"path/filepath"
	"reflect"
	"strconv"
	"strings"
	"time"


@@ 309,7 310,7 @@ func (s *Storage) Restore(path string) error {
	}

	switch m := (*msg).(type) {
	case barefeed.MessageV1:
	case *barefeed.MessageV1:
		if err := s.processMessageV1(db, m); err != nil {
			if err := s.deleteDBs(db); err != nil {
				if err := db.Close(); err != nil {


@@ 327,13 328,13 @@ func (s *Storage) Restore(path string) error {
		if err := db.Close(); err != nil {
			return err
		}
		return fmt.Errorf("unsupported message format")
		return fmt.Errorf("unsupported message format: %s", reflect.TypeOf(m).String())
	}

	return db.Close()
}

func (s *Storage) processMessageV1(db *bolt.DB, msg barefeed.MessageV1) error {
func (s *Storage) processMessageV1(db *bolt.DB, msg *barefeed.MessageV1) error {
	for _, feed := range msg.Feeds {
		f := Feed{
			Title:       feed.Title,