Documentation
¶
Overview ¶
Package embedded transfers the contents of an OCM embedded share (an RO-Crate JSON payload listing plain or Zenodo files) to a WebDAV destination, streaming each referenced file in the background.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NewFuncs = map[string]NewFunc{}
NewFuncs holds the registered embedded-transfer drivers.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// WebDAVURL is the destination WebDAV endpoint files are uploaded to.
WebDAVURL string `mapstructure:"webdav_url"`
// Timeout is the per-file ceiling, in seconds.
Timeout int `mapstructure:"embedded_transfer_timeout"`
// IdleTimeout, in seconds, aborts a file attempt if no bytes flow for that long.
IdleTimeout int `mapstructure:"embedded_transfer_idle_timeout"`
// Retries is the number of attempts per file (1 = no retry).
Retries int `mapstructure:"embedded_transfer_retries"`
}
Config holds the settings for transferring embedded share payloads.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults fills in sensible defaults for any unset setting.
type Transferrer ¶
type Transferrer interface {
Process(ctx context.Context, payload, destination string, onComplete func(error)) error
}
Transferrer processes an embedded share payload, transferring its referenced files to a destination. Drivers register an implementation via Register.
Process returns synchronously once the transfer has been scheduled; the actual copy runs in the background. The optional onComplete callback is invoked once the transfer has finished, with a nil error on success, allowing the caller to observe completion (e.g. to advance the share state). A malformed payload is reported as a synchronous error from Process and onComplete is not called.