MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / Seek

Method Seek

pkg/buffer/utils.go:68–87  ·  view source on GitHub ↗
(offset int64, whence int)

Source from the content-addressed store, hash-verified

66}
67
68func (r *DynamicReadAtSeeker) Seek(offset int64, whence int) (int64, error) {
69 switch whence {
70 case io.SeekStart:
71 case io.SeekCurrent:
72 if offset == 0 {
73 return r.offset, nil
74 }
75 offset = r.offset + offset
76 case io.SeekEnd:
77 offset = r.block.Size() + offset
78 default:
79 return 0, errors.New("Seek: invalid whence")
80 }
81
82 if offset < 0 || offset > r.block.Size() {
83 return 0, errors.New("Seek: invalid offset")
84 }
85 r.offset = offset
86 return offset, nil
87}
88
89func NewDynamicReadAtSeeker(block Block) *DynamicReadAtSeeker {
90 return &DynamicReadAtSeeker{

Callers 4

CreateTempFileFunction · 0.45
HashFileFunction · 0.45
ResetMethod · 0.45
reqMethod · 0.45

Calls 1

SizeMethod · 0.65

Tested by

no test coverage detected