NewStaticObjectInfo returns a static ObjectInfo If hashes is nil and fs is not nil, the hash map will be replaced with empty hashes of the types supported by the fs.
(remote string, modTime time.Time, size int64, storable bool, hashes map[hash.Type]string, f fs.Info)
| 28 | // If hashes is nil and fs is not nil, the hash map will be replaced with |
| 29 | // empty hashes of the types supported by the fs. |
| 30 | func NewStaticObjectInfo(remote string, modTime time.Time, size int64, storable bool, hashes map[hash.Type]string, f fs.Info) *StaticObjectInfo { |
| 31 | info := &StaticObjectInfo{ |
| 32 | remote: remote, |
| 33 | modTime: modTime, |
| 34 | size: size, |
| 35 | storable: storable, |
| 36 | hashes: hashes, |
| 37 | fs: f, |
| 38 | } |
| 39 | if f != nil && hashes == nil { |
| 40 | set := f.Hashes().Array() |
| 41 | info.hashes = make(map[hash.Type]string) |
| 42 | for _, ht := range set { |
| 43 | info.hashes[ht] = "" |
| 44 | } |
| 45 | } |
| 46 | if f == nil { |
| 47 | info.fs = MemoryFs |
| 48 | } |
| 49 | return info |
| 50 | } |
| 51 | |
| 52 | // WithMetadata adds meta to the ObjectInfo |
| 53 | func (i *StaticObjectInfo) WithMetadata(meta fs.Metadata) *StaticObjectInfo { |
searching dependent graphs…