embedded

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

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) error
}

Transferrer processes an embedded share payload, transferring its referenced files to a destination. Drivers register an implementation via Register.

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