Remove error from return value of NewContentHandler

This commit is contained in:
Alexander Neumann 2015-01-04 20:07:30 +01:00
parent 4b70bba588
commit fe231af7fc
8 changed files with 9 additions and 28 deletions

View file

@ -55,10 +55,7 @@ func NewArchiver(s Server, p *Progress) (*Archiver, error) {
arch.Filter = func(string, os.FileInfo) bool { return true } arch.Filter = func(string, os.FileInfo) bool { return true }
arch.bl = NewBlobList() arch.bl = NewBlobList()
arch.ch, err = NewContentHandler(s) arch.ch = NewContentHandler(s)
if err != nil {
return nil, err
}
// load all blobs from all snapshots // load all blobs from all snapshots
err = arch.ch.LoadAllMaps() err = arch.ch.LoadAllMaps()

View file

@ -53,10 +53,7 @@ func (cmd CmdCat) Execute(args []string) error {
} }
} }
ch, err := restic.NewContentHandler(s) ch := restic.NewContentHandler(s)
if err != nil {
return err
}
switch tpe { switch tpe {
case "blob": case "blob":

View file

@ -113,11 +113,7 @@ func (c CmdFind) findInTree(ch *restic.ContentHandler, id backend.ID, path strin
func (c CmdFind) findInSnapshot(s restic.Server, id backend.ID) error { func (c CmdFind) findInSnapshot(s restic.Server, id backend.ID) error {
debug("searching in snapshot %s\n for entries within [%s %s]", id, c.oldest, c.newest) debug("searching in snapshot %s\n for entries within [%s %s]", id, c.oldest, c.newest)
ch, err := restic.NewContentHandler(s) ch := restic.NewContentHandler(s)
if err != nil {
return err
}
sn, err := ch.LoadSnapshot(id) sn, err := ch.LoadSnapshot(id)
if err != nil { if err != nil {
return err return err

View file

@ -125,10 +125,7 @@ func fsckTree(opts CmdFsck, ch *restic.ContentHandler, id backend.ID) error {
func fsck_snapshot(opts CmdFsck, s restic.Server, id backend.ID) error { func fsck_snapshot(opts CmdFsck, s restic.Server, id backend.ID) error {
debug("checking snapshot %v\n", id) debug("checking snapshot %v\n", id)
ch, err := restic.NewContentHandler(s) ch := restic.NewContentHandler(s)
if err != nil {
return err
}
sn, err := ch.LoadSnapshot(id) sn, err := ch.LoadSnapshot(id)
if err != nil { if err != nil {

View file

@ -78,7 +78,7 @@ func (cmd CmdLs) Execute(args []string) error {
return err return err
} }
ch, err := restic.NewContentHandler(s) ch := restic.NewContentHandler(s)
if err != nil { if err != nil {
return err return err
} }

View file

@ -97,10 +97,7 @@ func (cmd CmdSnapshots) Execute(args []string) error {
return err return err
} }
ch, err := restic.NewContentHandler(s) ch := restic.NewContentHandler(s)
if err != nil {
return err
}
tab := NewTable() tab := NewTable()
tab.Header = fmt.Sprintf("%-8s %-19s %-10s %s", "ID", "Date", "Source", "Directory") tab.Header = fmt.Sprintf("%-8s %-19s %-10s %s", "ID", "Date", "Source", "Directory")

View file

@ -17,13 +17,13 @@ type ContentHandler struct {
} }
// NewContentHandler creates a new content handler. // NewContentHandler creates a new content handler.
func NewContentHandler(s Server) (*ContentHandler, error) { func NewContentHandler(s Server) *ContentHandler {
ch := &ContentHandler{ ch := &ContentHandler{
s: s, s: s,
bl: NewBlobList(), bl: NewBlobList(),
} }
return ch, nil return ch
} }
// LoadSnapshot adds all blobs from a snapshot into the content handler and returns the snapshot. // LoadSnapshot adds all blobs from a snapshot into the content handler and returns the snapshot.

View file

@ -25,10 +25,7 @@ func NewRestorer(s Server, snid backend.ID) (*Restorer, error) {
r := &Restorer{s: s} r := &Restorer{s: s}
var err error var err error
r.ch, err = NewContentHandler(s) r.ch = NewContentHandler(s)
if err != nil {
return nil, arrar.Annotate(err, "create contenthandler for restorer")
}
r.sn, err = r.ch.LoadSnapshot(snid) r.sn, err = r.ch.LoadSnapshot(snid)
if err != nil { if err != nil {