Remove Each(), add basic stats
This commit is contained in:
parent
4bb7f2f2ed
commit
b6f25aa690
6 changed files with 82 additions and 71 deletions
|
@ -24,30 +24,6 @@ var (
|
|||
|
||||
const hashSize = sha256.Size
|
||||
|
||||
// Each lists all entries of type t in the backend and calls function f() with
|
||||
// the id and data.
|
||||
func Each(be interface {
|
||||
Lister
|
||||
Getter
|
||||
}, t Type, f func(id ID, data []byte, err error)) error {
|
||||
ids, err := be.List(t)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, id := range ids {
|
||||
data, err := be.Get(t, id)
|
||||
if err != nil {
|
||||
f(id, nil, err)
|
||||
continue
|
||||
}
|
||||
|
||||
f(id, data, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Each lists all entries of type t in the backend and calls function f() with
|
||||
// the id.
|
||||
func EachID(be Lister, t Type, f func(ID)) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue