NewFileReader returns a new FileReader, reading bytes and blobs from the provided fetcher. NewFileReader does no fetch operation on the fetcher itself. The fetcher is only used in subsequent read operations. An error is only returned if the type of the superset is not either "file" or "bytes".
(fetcher blob.Fetcher)
| 106 | // An error is only returned if the type of the superset is not either |
| 107 | // "file" or "bytes". |
| 108 | func (ss *superset) NewFileReader(fetcher blob.Fetcher) (*FileReader, error) { |
| 109 | if ss.Type != "file" && ss.Type != "bytes" { |
| 110 | return nil, fmt.Errorf("schema/filereader: Superset not of type \"file\" or \"bytes\"") |
| 111 | } |
| 112 | size := int64(ss.SumPartsSize()) |
| 113 | fr := &FileReader{ |
| 114 | fetcher: fetcher, |
| 115 | ss: ss, |
| 116 | size: size, |
| 117 | ssm: make(map[blob.Ref]*superset), |
| 118 | } |
| 119 | fr.SectionReader = io.NewSectionReader(fr, 0, size) |
| 120 | return fr, nil |
| 121 | } |
| 122 | |
| 123 | // LoadAllChunks starts a process of loading all chunks of this file |
| 124 | // as quickly as possible. The contents are immediately discarded, so |
no test coverage detected