mirror of
https://github.com/restic/restic.git
synced 2025-12-23 01:36:15 +00:00
Store maps in new subdir "maps"
This commit is contained in:
12
bloblist.go
12
bloblist.go
@@ -6,6 +6,8 @@ import (
|
||||
"errors"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"github.com/fd0/khepri/backend"
|
||||
)
|
||||
|
||||
type BlobList struct {
|
||||
@@ -21,6 +23,16 @@ func NewBlobList() *BlobList {
|
||||
}
|
||||
}
|
||||
|
||||
func LoadBlobList(ch *ContentHandler, id backend.ID) (*BlobList, error) {
|
||||
bl := &BlobList{}
|
||||
err := ch.LoadJSONRaw(backend.Map, id, bl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return bl, nil
|
||||
}
|
||||
|
||||
func (bl *BlobList) find(blob Blob) (int, Blob, error) {
|
||||
pos := sort.Search(len(bl.list), func(i int) bool {
|
||||
return blob.ID.Compare(bl.list[i].ID) >= 0
|
||||
|
||||
Reference in New Issue
Block a user