MCPcopy
hub / github.com/kopia/kopia / NewMapStorageWithLimit

Function NewMapStorageWithLimit

internal/blobtesting/map.go:243–259  ·  view source on GitHub ↗

NewMapStorageWithLimit returns an implementation of Storage backed by the contents of given map. Used primarily for testing.

(data DataMap, keyTime map[blob.ID]time.Time, timeNow func() time.Time, limit int64)

Source from the content-addressed store, hash-verified

241// NewMapStorageWithLimit returns an implementation of Storage backed by the contents of given map.
242// Used primarily for testing.
243func NewMapStorageWithLimit(data DataMap, keyTime map[blob.ID]time.Time, timeNow func() time.Time, limit int64) blob.Storage {
244 if keyTime == nil {
245 keyTime = make(map[blob.ID]time.Time)
246 }
247
248 if timeNow == nil {
249 timeNow = clock.Now
250 }
251
252 totalBytes := int64(0)
253
254 for _, v := range data {
255 totalBytes += int64(len(v))
256 }
257
258 return &mapStorage{data: data, keyTime: keyTime, timeNow: timeNow, limit: limit, totalBytes: totalBytes}
259}

Calls

no outgoing calls