AsStaticFile returns the Blob as a StaticFile if it represents one. Otherwise, it returns false in the boolean parameter and the zero value of StaticFile.
()
| 284 | // one. Otherwise, it returns false in the boolean parameter and the |
| 285 | // zero value of StaticFile. |
| 286 | func (b *Blob) AsStaticFile() (sf StaticFile, ok bool) { |
| 287 | // TODO (marete) Add support for device files to |
| 288 | // Perkeep and change the implementation of StaticFile to |
| 289 | // reflect that. |
| 290 | t := b.ss.Type |
| 291 | if t == TypeFile || t == TypeSymlink || t == TypeFIFO || t == TypeSocket { |
| 292 | return StaticFile{b}, true |
| 293 | } |
| 294 | |
| 295 | return |
| 296 | } |
| 297 | |
| 298 | // A StaticFIFO is a StaticFile that is also a fifo. |
| 299 | type StaticFIFO struct { |
no outgoing calls