MCPcopy
hub / github.com/perkeep/perkeep / AsStaticFile

Method AsStaticFile

pkg/schema/blob.go:286–296  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

284// one. Otherwise, it returns false in the boolean parameter and the
285// zero value of StaticFile.
286func (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.
299type StaticFIFO struct {

Callers 5

fileInfoMethod · 0.80
TestStaticFIFOFunction · 0.80
TestStaticSocketFunction · 0.80
smartFetchFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestStaticFIFOFunction · 0.64
TestStaticSocketFunction · 0.64