Storage is an in-memory implementation of the blobserver Storage interface. It also includes other convenience methods used by tests. Its zero value is usable.
| 42 | // |
| 43 | // Its zero value is usable. |
| 44 | type Storage struct { |
| 45 | maxSize int64 // or zero if no limit |
| 46 | |
| 47 | mu sync.RWMutex // guards following 2 fields. |
| 48 | m map[blob.Ref][]byte // maps blob ref to its contents |
| 49 | size int64 // sum of len(values(m)) |
| 50 | |
| 51 | // lru is non-nil if we're in cache mode. |
| 52 | // Else it maps blobref.String() to a nil value. |
| 53 | lru *lru.Cache |
| 54 | |
| 55 | blobsFetched int64 // atomic |
| 56 | bytesFetched int64 // atomic |
| 57 | } |
| 58 | |
| 59 | var _ blobserver.BlobStreamer = (*Storage)(nil) |
| 60 |
nothing calls this directly
no outgoing calls
no test coverage detected