sync

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sync provides file-watching and S3-syncing for static assets. It performs an initial one-shot upload of all files in a directory, then optionally watches for filesystem changes and syncs them continuously.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(dir, path string) string

Key converts a filesystem path into an S3 object key relative to dir. Returns "" for paths that should be skipped (e.g. .gitkeep).

func SyncAll

func SyncAll(ctx context.Context, store storage.FileStorage, dir string) error

SyncAll performs a one-shot upload of every file under dir to the storage backend. If the store implements BucketEnsurer, the bucket is created first.

func WatchAndSync

func WatchAndSync(ctx context.Context, store storage.FileStorage, dir string) error

WatchAndSync watches dir for filesystem changes and syncs them to the storage backend. It blocks until ctx is cancelled or the watcher errors.

Types

type BucketEnsurer

type BucketEnsurer interface {
	EnsureBucket(ctx context.Context) error
}

BucketEnsurer is optionally implemented by storage backends that need their bucket created before first use (e.g. S3/RustFS in dev mode).

Jump to

Keyboard shortcuts

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