mirror

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package mirror provides support for the infrastructure-specific mirror tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mirror

type Mirror struct {
	NumWorkers uint
	Source     Source
	Target     Target
	// contains filtered or unexported fields
}

Mirror is a struct which knows how to use the Src and Store functions to copy a tlog-tiles compliant log from one location to another.

The checkpoint will only be stored once all static resources have been successfully copied. Errors fetching or storing operations will cause the operation to be retried a few times before eventually giving up.

Note that this function _only copies the data_; no self-consistency or correctness checking of the copied tiles/entries/checkpoint is undertaken.

func (*Mirror) Progress

func (m *Mirror) Progress() (uint64, uint64)

Progress returns the total number of resources present in the source log, and the number of resources successfully copied to the destination so far.

func (*Mirror) Run

func (m *Mirror) Run(ctx context.Context) error

Run performs the copy operation.

This is a long-lived operation, returning only once ctx becomes Done, the copy is completed, or an error occurs during the operation.

type Source

type Source interface {
	ReadCheckpoint(ctx context.Context) ([]byte, error)
	ReadTile(ctx context.Context, l, i uint64, p uint8) ([]byte, error)
	ReadEntryBundle(_ context.Context, i uint64, p uint8) ([]byte, error)
}

Source describes a type which can fetch static resources from a source log, like the .*Fetcher implementations in the client package.

type Target

type Target interface {
	ReadCheckpoint(ctx context.Context) ([]byte, error)
	WriteCheckpoint(ctx context.Context, data []byte) error
	WriteTile(ctx context.Context, l, i uint64, p uint8, data []byte) error
	WriteEntryBundle(ctx context.Context, i uint64, p uint8, data []byte) error
}

Target describes a type which can store log static resources.

Jump to

Keyboard shortcuts

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