Documentation
¶
Index ¶
- type Config
- type Option
- func AddressOption(address string) Option
- func ListenAddressOption(addr string) Option
- func RangeSizeOption(size int64) Option
- func TimeoutOption(timeout time.Duration) Option
- func TokenOption(token string) Option
- func TraversalModeOption(mode TraversalMode) Option
- func VerboseOption(verbose bool) Option
- type TraversalMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ListenAddr string Address string Token string Timeout time.Duration Mode TraversalMode RangeSize int64 Verbose bool }
Config is a set of titan SDK options.
type Option ¶
type Option func(opts *Config)
Option is a single titan sdk Config.
func AddressOption ¶
AddressOption set titan server address
func ListenAddressOption ¶
ListenAddressOption set the listen address for titan client, default is :8863
func RangeSizeOption ¶
RangeSizeOption specifies the maximum size of each file range that can be downloaded in a single HTTP request. Each range of data is read into memory and then written to the output stream, so the amount of memory used is directly proportional to the size of rangeSize.
Specifically, the estimated amount of memory used can be calculated as maxConcurrent x rangeSize. Keep an eye on memory usage when modifying this value, as setting it too high can result in excessive memory usage and potential out-of-memory errors.
This option only works when using `TraversalModeRange` to download files.
func TimeoutOption ¶
TimeoutOption specifies a time limit for requests made by the http Client.
func TraversalModeOption ¶
func TraversalModeOption(mode TraversalMode) Option
TraversalModeOption set the download file traversal algorithm, default using DFS pre-order walk algorithm for dag.
func VerboseOption ¶
VerboseOption Make the operation more talkative
type TraversalMode ¶
type TraversalMode int
const ( // TraversalModeDFS only supports retrieving CAR files and auto decodes them into the raw file format. TraversalModeDFS TraversalMode = iota + 1 // TraversalModeRange allows you to retrieve files of any type, but it does not decode, the files will be retrieved in their original format. // It's important to note that when using `TraversalModeRange` to retrieve a CAR file, the entire file must be downloaded before it can be decoded. TraversalModeRange )