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.bl = NewBlobList()
arch.ch, err = NewContentHandler(s)
if err != nil {
return nil, err
}
arch.ch = NewContentHandler(s)
// load all blobs from all snapshots
err = arch.ch.LoadAllMaps()

View file

@ -53,10 +53,7 @@ func (cmd CmdCat) Execute(args []string) error {
}
}
ch, err := restic.NewContentHandler(s)
if err != nil {
return err
}
ch := restic.NewContentHandler(s)
switch tpe {
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 {
debug("searching in snapshot %s\n for entries within [%s %s]", id, c.oldest, c.newest)
ch, err := restic.NewContentHandler(s)
if err != nil {
return err
}
ch := restic.NewContentHandler(s)
sn, err := ch.LoadSnapshot(id)
if err != nil {
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 {
debug("checking snapshot %v\n", id)
ch, err := restic.NewContentHandler(s)
if err != nil {
return err
}
ch := restic.NewContentHandler(s)
sn, err := ch.LoadSnapshot(id)
if err != nil {

View file

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

View file

@ -97,10 +97,7 @@ func (cmd CmdSnapshots) Execute(args []string) error {
return err
}
ch, err := restic.NewContentHandler(s)
if err != nil {
return err
}
ch := restic.NewContentHandler(s)
tab := NewTable()
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.
func NewContentHandler(s Server) (*ContentHandler, error) {
func NewContentHandler(s Server) *ContentHandler {
ch := &ContentHandler{
s: s,
bl: NewBlobList(),
}
return ch, nil
return ch
}
// 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}
var err error
r.ch, err = NewContentHandler(s)
if err != nil {
return nil, arrar.Annotate(err, "create contenthandler for restorer")
}
r.ch = NewContentHandler(s)
r.sn, err = r.ch.LoadSnapshot(snid)
if err != nil {