mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 23:06:32 +00:00
Cleanup index code
The selectFn wasn't used any more, so remove it from generatePackList().
This commit is contained in:
parent
650eab6a0e
commit
2710d6399a
@ -233,10 +233,8 @@ type blobJSON struct {
|
|||||||
Length uint `json:"length"`
|
Length uint `json:"length"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// generatePackList returns a list of packs containing only the index entries
|
// generatePackList returns a list of packs.
|
||||||
// that selsectFn returned true for. If selectFn is nil, the list contains all
|
func (idx *Index) generatePackList() ([]*packJSON, error) {
|
||||||
// blobs in the index.
|
|
||||||
func (idx *Index) generatePackList(selectFn func(indexEntry) bool) ([]*packJSON, error) {
|
|
||||||
list := []*packJSON{}
|
list := []*packJSON{}
|
||||||
packs := make(map[backend.ID]*packJSON)
|
packs := make(map[backend.ID]*packJSON)
|
||||||
|
|
||||||
@ -245,10 +243,6 @@ func (idx *Index) generatePackList(selectFn func(indexEntry) bool) ([]*packJSON,
|
|||||||
panic("nil pack id")
|
panic("nil pack id")
|
||||||
}
|
}
|
||||||
|
|
||||||
if selectFn != nil && !selectFn(blob) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Log("Index.generatePackList", "handle blob %v", id.Str())
|
debug.Log("Index.generatePackList", "handle blob %v", id.Str())
|
||||||
|
|
||||||
if blob.packID.IsNull() {
|
if blob.packID.IsNull() {
|
||||||
@ -302,7 +296,7 @@ func (idx *Index) Encode(w io.Writer) error {
|
|||||||
func (idx *Index) encode(w io.Writer) error {
|
func (idx *Index) encode(w io.Writer) error {
|
||||||
debug.Log("Index.encode", "encoding index")
|
debug.Log("Index.encode", "encoding index")
|
||||||
|
|
||||||
list, err := idx.generatePackList(nil)
|
list, err := idx.generatePackList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -332,7 +326,7 @@ func (idx *Index) Dump(w io.Writer) error {
|
|||||||
idx.m.Lock()
|
idx.m.Lock()
|
||||||
defer idx.m.Unlock()
|
defer idx.m.Unlock()
|
||||||
|
|
||||||
list, err := idx.generatePackList(nil)
|
list, err := idx.generatePackList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user