MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Close

Method Close

internal/caches/reader_file.go:359–377  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

357}
358
359func (this *FileReader) Close() error {
360 if this.isClosed {
361 return nil
362 }
363 this.isClosed = true
364
365 if this.openFileCache != nil {
366 if this.openFile != nil {
367 this.openFileCache.Put(this.fp.Name(), this.openFile)
368 } else {
369 var cacheMeta = make([]byte, len(this.meta))
370 copy(cacheMeta, this.meta)
371 this.openFileCache.Put(this.fp.Name(), NewOpenFile(this.fp.Raw(), cacheMeta, this.header, this.LastModified(), this.bodySize))
372 }
373 return nil
374 }
375
376 return this.fp.Close()
377}
378
379func (this *FileReader) readToBuff(fp *fsutils.File, buf []byte) (ok bool, err error) {
380 n, err := fp.Read(buf)

Callers

nothing calls this directly

Calls 6

LastModifiedMethod · 0.95
NewOpenFileFunction · 0.85
NameMethod · 0.65
CloseMethod · 0.65
PutMethod · 0.45
RawMethod · 0.45

Tested by

no test coverage detected