MCPcopy
hub / github.com/kahing/goofys / initBuffer

Method initBuffer

internal/file.go:320–339  ·  view source on GitHub ↗
(fh *FileHandle, offset uint64, size uint32)

Source from the content-addressed store, hash-verified

318}
319
320func (b *S3ReadBuffer) initBuffer(fh *FileHandle, offset uint64, size uint32) {
321 getFunc := func() (io.ReadCloser, error) {
322 resp, err := b.s3.GetBlob(&GetBlobInput{
323 Key: fh.key,
324 Start: offset,
325 Count: uint64(size),
326 })
327 if err != nil {
328 return nil, err
329 }
330
331 return resp.Body, nil
332 }
333
334 if b.buf == nil {
335 b.buf = Buffer{}.Init(b.mbuf, getFunc)
336 } else {
337 b.buf.ReInit(getFunc)
338 }
339}
340
341func (b *S3ReadBuffer) Read(offset uint64, p []byte) (n int, err error) {
342 if b.offset == offset {

Callers 2

InitMethod · 0.95
readFromReadAheadMethod · 0.80

Calls 3

ReInitMethod · 0.80
GetBlobMethod · 0.65
InitMethod · 0.65

Tested by

no test coverage detected