Versions in this module Expand all Collapse all v1 v1.8.2 Nov 5, 2026 Changes in this version + var ErrBackpressure = errors.New("stream: backpressure limit reached") + type Backpressure int + const BackpressureAdaptive + const BackpressureBlock + const BackpressureBuffer + const BackpressureDrop + func (b Backpressure) String() string + type BackpressureHandler interface + Send func(ctx context.Context, ch chan *Chunk, chunk *Chunk) error + func NewAdaptiveHandler() BackpressureHandler + func NewBackpressureHandler(mode Backpressure, pool *ChunkPool) BackpressureHandler + func NewBlockHandler() BackpressureHandler + func NewBufferHandler(maxOverflow int) BackpressureHandler + func NewDropHandler(pool *ChunkPool) BackpressureHandler + type Checksum struct + Algorithm string + Value []byte + type Chunk struct + Checksum Checksum + Data []byte + Final bool + Index int + Offset int64 + Size int + type ChunkAck struct + ETag string + Err error + Index int + type ChunkHook func(*Chunk, ChunkAck) + type ChunkPool struct + func NewChunkPool(chunkSize int64) *ChunkPool + func (cp *ChunkPool) ChunkSize() int64 + func (cp *ChunkPool) Get() []byte + func (cp *ChunkPool) Put(buf []byte) + func (cp *ChunkPool) Stats() ChunkPoolStats + type ChunkPoolStats struct + Allocated int64 + ChunkSize int64 + Released int64 + type CompleteHook func(*driver.ObjectInfo) + type ControlMsg struct + Offset int64 + Type ControlType + type ControlType int + const CtrlCancel + const CtrlPause + const CtrlResume + const CtrlSeek + type Direction int + const DirectionBiDi + const DirectionDownload + const DirectionUpload + func (d Direction) String() string + type ErrorHook func(error) + type Metrics struct + BytesRecv atomic.Int64 + BytesSent atomic.Int64 + Chunks atomic.Int64 + Retries atomic.Int64 + StartTime time.Time + func NewMetrics() *Metrics + func (sm *Metrics) StreamSnapshot() Snapshot + func (sm *Metrics) Throughput() float64 + type MetricsSnapshot struct + ActiveStreams int64 + AvgThroughput float64 + FailedStreams int64 + P99Latency time.Duration + RetryCount int64 + TotalBytes int64 + TotalChunks int64 + type Option func(*streamConfig) + func WithBackpressure(mode Backpressure) Option + func WithChannelSize(n int) Option + func WithChunkSize(size int64) Option + func WithOnChunk(fn ChunkHook) Option + func WithOnComplete(fn CompleteHook) Option + func WithOnError(fn ErrorHook) Option + func WithOnProgress(fn ProgressHook) Option + func WithPool(name string) Option + func WithResumable() Option + type Pool struct + Config PoolConfig + ID id.ID + Metrics *PoolMetrics + Name string + func NewPool(name string, cfg PoolConfig) *Pool + func (p *Pool) Acquire(ctx context.Context, dir Direction, bucket, key string, opts ...Option) (*Stream, error) + func (p *Pool) ActiveCount() int + func (p *Pool) ChunkPool() *ChunkPool + func (p *Pool) Close() error + func (p *Pool) Get(streamID id.ID) *Stream + func (p *Pool) Range(fn func(s *Stream) bool) + func (p *Pool) Release(s *Stream) + type PoolConfig struct + BackpressureMode Backpressure + BufferCount int + ChunkSize int64 + IdleTimeout time.Duration + MaxBandwidth int64 + MaxStreams int + StreamTimeout time.Duration + func DefaultPoolConfig() PoolConfig + type PoolMetrics struct + ActiveStreams atomic.Int64 + FailedStreams atomic.Int64 + RetryCount atomic.Int64 + TotalBytes atomic.Int64 + TotalChunks atomic.Int64 + func (m *PoolMetrics) AvgThroughput() float64 + func (m *PoolMetrics) P99Latency() time.Duration + func (m *PoolMetrics) RecordBytes(n int64) + func (m *PoolMetrics) RecordChunk() + func (m *PoolMetrics) RecordFailure() + func (m *PoolMetrics) RecordRetry() + func (m *PoolMetrics) SetAvgThroughput(bps float64) + func (m *PoolMetrics) SetP99Latency(d time.Duration) + func (m *PoolMetrics) Snapshot() MetricsSnapshot + type Progress struct + BytesRecv int64 + BytesSent int64 + Percent int + Speed float64 + StreamID id.ID + TotalSize int64 + type ProgressHook func(Progress) + type Snapshot struct + BytesRecv int64 + BytesSent int64 + Chunks int64 + Elapsed time.Duration + Retries int64 + Throughput float64 + type State string + const StateActive + const StateCancelled + const StateCompleted + const StateCompleting + const StateFailed + const StateIdle + const StatePaused + func (s State) IsTerminal() bool + type Stream struct + Bucket string + Direction Direction + ID id.ID + Key string + func NewStream(ctx context.Context, dir Direction, bucket, key string, chunkPool *ChunkPool, ...) *Stream + func (s *Stream) Ack(ack ChunkAck) + func (s *Stream) BackpressureMode() Backpressure + func (s *Stream) ChunkPool() *ChunkPool + func (s *Stream) Close() + func (s *Stream) Complete(info *driver.ObjectInfo) error + func (s *Stream) Control(msg ControlMsg) error + func (s *Stream) ControlChan() <-chan ControlMsg + func (s *Stream) Done() <-chan struct{} + func (s *Stream) Err() error + func (s *Stream) Fail(err error) + func (s *Stream) Metrics() *Metrics + func (s *Stream) Offset() int64 + func (s *Stream) Read(ctx context.Context) (*Chunk, error) + func (s *Stream) ReadAck(ctx context.Context) (ChunkAck, error) + func (s *Stream) Resumable() bool + func (s *Stream) SetTotalSize(n int64) + func (s *Stream) Start() error + func (s *Stream) State() State + func (s *Stream) TotalSize() int64 + func (s *Stream) Write(chunk *Chunk) error v1.8.1 Oct 20, 2026 v1.8.0 Oct 18, 2026 v1.7.1 Oct 11, 2026 v1.7.0 Oct 8, 2026 v1.6.6 Sep 3, 2026 v1.6.5 Aug 24, 2026 v1.6.4 Aug 21, 2026 v1.6.3 Aug 21, 2026 v1.6.2 Aug 14, 2026 v1.6.1 Aug 4, 2026 v1.6.0 Aug 4, 2026 v1.5.1 Jun 18, 2026 v1.5.0 May 18, 2026 v1.4.1 Mar 29, 2026 v1.4.0 Mar 28, 2026 v1.3.1 Mar 14, 2026