mirror

package
v0.14.21 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mirror supervises mobility-aware continuous directory mirrors. Each job mirrors a local directory to a peer's mesh service, but ONLY while that peer is reachable (and same-LAN when LANOnly): it PAUSES when the mirrored pair becomes remote/absent and RESUMES — catching up via the engine's initial full sync — when the pair is local again (e.g. a laptop returns to the LAN). The transfer engine is coreutils/pkg/mirror (recursive watch + rclone sync, all permissive); the mesh integration is injected as a Linker so this package stays free of the mesh/peerplane import graph.

Index

Constants

This section is empty.

Variables

View Source
var PollInterval = 15 * time.Second

PollInterval is how often each job re-checks the pair's reachability/locality.

Functions

This section is empty.

Types

type Linker

type Linker interface {
	// Reachable reports whether a peer offering service is reachable now — and,
	// when lanOnly, on the same LAN. This is the resume(true)/pause(false) signal.
	Reachable(ctx context.Context, service string, lanOnly bool) bool
	// Open resolves a peer offering service and opens a forward to it, returning
	// an rclone dest target (pointing at the local forward) + a stop func.
	Open(ctx context.Context, service string) (dest string, stop func(), err error)
}

Linker is the mesh integration the supervisor needs (implemented in main.go).

type Supervisor

type Supervisor struct {
	Link   Linker
	Logger *slog.Logger
	// contains filtered or unexported fields
}

Supervisor runs the configured mobility-aware mirror jobs.

func (*Supervisor) Run

func (s *Supervisor) Run(ctx context.Context, jobs []conf.MirrorJob)

Run blocks until ctx is cancelled, supervising one goroutine per job.

Jump to

Keyboard shortcuts

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