MCPcopy Index your code
hub / github.com/rclone/rclone / Open

Method Open

backend/internxt/internxt.go:845–869  ·  view source on GitHub ↗

Open opens a file for streaming

(ctx context.Context, options ...fs.OpenOption)

Source from the content-addressed store, hash-verified

843
844// Open opens a file for streaming
845func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error) {
846 fs.FixRangeOption(options, o.size)
847 rangeValue := ""
848 for _, option := range options {
849 switch option.(type) {
850 case *fs.RangeOption, *fs.SeekOption:
851 _, rangeValue = option.Header()
852 }
853 }
854
855 if o.size == 0 {
856 return io.NopCloser(bytes.NewReader(nil)), nil
857 }
858
859 var stream io.ReadCloser
860 err := o.f.pacer.Call(func() (bool, error) {
861 var err error
862 stream, err = buckets.DownloadFileStream(ctx, o.f.cfg, o.id, rangeValue)
863 return o.f.shouldRetry(ctx, err)
864 })
865 if err != nil {
866 return nil, err
867 }
868 return stream, nil
869}
870
871// Update updates an existing file or creates a new one
872func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error {

Callers

nothing calls this directly

Calls 4

FixRangeOptionFunction · 0.92
HeaderMethod · 0.65
CallMethod · 0.45
shouldRetryMethod · 0.45

Tested by

no test coverage detected