MCPcopy
hub / github.com/wavetermdev/waveterm / ReadAt

Method ReadAt

pkg/filestore/blockstore.go:370–379  ·  view source on GitHub ↗

returns (offset, data, error) we return the offset because the offset may have been adjusted if the size was too big (for circular files)

(ctx context.Context, zoneId string, name string, offset int64, size int64)

Source from the content-addressed store, hash-verified

368// returns (offset, data, error)
369// we return the offset because the offset may have been adjusted if the size was too big (for circular files)
370func (s *FileStore) ReadAt(ctx context.Context, zoneId string, name string, offset int64, size int64) (rtnOffset int64, rtnData []byte, rtnErr error) {
371 if size < 0 || size > math.MaxInt {
372 return 0, nil, fmt.Errorf("size must be non-negative and less than MaxInt")
373 }
374 withLock(s, zoneId, name, func(entry *CacheEntry) error {
375 rtnOffset, rtnData, rtnErr = entry.readAt(ctx, offset, size, false)
376 return nil
377 })
378 return
379}
380
381// returns (offset, data, error)
382func (s *FileStore) ReadFile(ctx context.Context, zoneId string, name string) (rtnOffset int64, rtnData []byte, rtnErr error) {

Callers 5

DebugTermCommandMethod · 0.80
handleWaveFileFunction · 0.80
rebufferMethod · 0.80
checkFileDataAtFunction · 0.80
TestMultiPartFunction · 0.80

Calls 2

withLockFunction · 0.85
readAtMethod · 0.80

Tested by 2

checkFileDataAtFunction · 0.64
TestMultiPartFunction · 0.64