Versions in this module Expand all Collapse all v1 v1.0.3 Nov 19, 2026 Changes in this version + const DefaultMaxChunkBytes + const EncodeOperation + const EncodePath + const JobHeader + const JobProofHeader + const ResultHeader + const ResultProofHeader + const Version + var ErrBusy = errors.New("compression queue is full") + var ErrIntegrity = errors.New("compression integrity check failed") + var ErrInvalid = errors.New("invalid compression request") + func Hash(data []byte) string + func JobProof(j Job) []byte + func ResultProof(requestID string, result Result, h http.Header, status int) []byte + func SetJob(r *http.Request, j Job) error + type Codec struct + func New(cfg Config) (*Codec, error) + func (c *Codec) Close() error + func (c *Codec) Decode(ctx context.Context, src io.Reader, dst io.Writer) error + func (c *Codec) Encode(ctx context.Context, raw []byte, dst io.Writer) (codec.Stats, error) + func (c *Codec) Name() string + func (c *Codec) Stats() Stats + type Config struct + Authorize func(*http.Request, Job) error + EstimatedRatio float64 + ForceRemote bool + HTTPClient *http.Client + Local codec.Codec + LocalBytesPerSecond float64 + MaxChunkBytes int64 + MaxConcurrent int + MinBytes int64 + NamespaceID string + NetworkBytesPerSecond float64 + Nodes func() []Member + QueueDepth int + RemoteTimeout time.Duration + RoundTrip time.Duration + VerifyResponse func(*http.Response, Result) error + type ForwardConfig struct + Authorize func(*http.Request, Job) error + HTTPClient *http.Client + MaxChunkBytes int64 + MaxConcurrent int + QueueDepth int + Resolve func(Job) (string, error) + Timeout time.Duration + type Forwarder struct + func NewForwarder(cfg ForwardConfig) (*Forwarder, error) + func (f *Forwarder) Close() error + func (f *Forwarder) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Job struct + Algorithm string + NamespaceID string + NodeID string + Operation string + RawHash string + RawSize int64 + RequestID string + StorageIncarnation string + Version int + func RequestJob(r *http.Request) (Job, error) + func (j Job) Validate(max int64) error + type Member struct + Active int + Algorithms []string + EncodeBytesPerSecond float64 + Endpoint string + MaxConcurrent int + NetworkBytesPerSecond float64 + NodeID string + QueueDepth int + RoundTrip time.Duration + StorageIncarnation string + type Result struct + Codec string + EncodedHash string + EncodedSize int64 + Job Job + Version int + func ResponseResult(r *http.Response) (Result, error) + func (r Result) Validate(max int64) error + type Server struct + func NewServer(cfg ServerConfig) (*Server, error) + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) Stats() ServerStats + type ServerConfig struct + Authorize func(*http.Request, Job) error + Codecs map[string]codec.Codec + Guard func(context.Context, func() error) error + MaxChunkBytes int64 + MaxConcurrent int + NodeID string + QueueDepth int + SignResponse func(*http.Request, Result, http.Header) error + StorageIncarnation string + Timeout time.Duration + type ServerStats struct + Active int + Completed uint64 + EncodedBytes uint64 + Failed uint64 + MaxConcurrent int + QueueDepth int64 + RawBytes uint64 + Rejected uint64 + type Stats struct + Active int + CPUFallbacks uint64 + LocalSelections uint64 + QueueDepth int64 + Rejected uint64 + RemoteAttempts uint64 + RemoteSuccess uint64