embedded

package
v3.15.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
var NewFuncs = map[string]NewFunc{}

NewFuncs holds the registered embedded-transfer drivers.

Functions

func Register

func Register(name string, f NewFunc)

Register adds an embedded-transfer driver. Safe for use from package init.

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 NewFunc

type NewFunc func(ctx context.Context, m map[string]any) (Transferrer, error)

NewFunc builds a Transferrer from its driver configuration.

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.

func New

func New(ctx context.Context, m map[string]any) (Transferrer, error)

New builds the built-in WebDAV embedded-transfer driver.

Jump to

Keyboard shortcuts

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