upload

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChunkServer

func NewChunkServer(logger *slog.Logger, fsys, cacheFS writablefs.FS) (string, http.Handler)

func NewServer

func NewServer(logger *slog.Logger, fsys, cacheFS writablefs.FS) (string, http.Handler)

Types

type ChunkServer

type ChunkServer struct {
	http.Handler
	// contains filtered or unexported fields
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(logger *slog.Logger, baseURL string, opts *ClientOptions) (*Client, error)

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, path string, r io.ReaderAt, size int64) error

Upload uploads a file to the server, you must provide a ReaderAt so that chunks can be read concurrently.

type ClientOptions

type ClientOptions struct {
	// NumConnections is the number of concurrent connections to use when uploading chunks.
	NumConnections int
	// ChunkSizeBytes is the size of each chunk.
	ChunkSizeBytes int64
	// MaxRetryAttempts is the maximum number of retry attempts to make before giving up.
	MaxRetryAttempts int
	// TLSClientConfig is the optional TLS configuration to use when making requests.
	TLSClientConfig *tls.Config
}

ClientOptions are options for configuring the behavior of the upload client.

type Server

type Server struct {
	http.Handler
	// contains filtered or unexported fields
}

func (*Server) Abort

func (*Server) Complete

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL