mirrored

package
v0.0.0-...-7e817e4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDownloader

func NewDownloader[TReference, TLeaseA, TLeaseB any](backendA object.Store[TReference, TLeaseA], backendB object.Store[TReference, TLeaseB]) object.Downloader[TReference]

NewDownloader creates a decorator for object.Downloader that attempts to read objects from two replicas.

If an object is only present in the second replicas that was queried, it is automatically copied to the first replica. This ensures that the object remains available if the second replica were to experience data loss.

func NewLeaseMarshaler

func NewLeaseMarshaler[TLeaseA, TLeaseB any](marshalerA leasemarshaling.LeaseMarshaler[TLeaseA], marshalerB leasemarshaling.LeaseMarshaler[TLeaseB]) leasemarshaling.LeaseMarshaler[Lease[TLeaseA, TLeaseB]]

NewLeaseMarshaler returns a marshaler that is capable of marshaling instances of Lease. These leases are marshaled by first storing leases of both of the replicas, followed by storing the length of lease A.

func NewUploader

func NewUploader[TReference, TLeaseA, TLeaseB any](replicaA object.Store[TReference, TLeaseA], replicaB object.Store[TReference, TLeaseB]) object.Uploader[TReference, Lease[TLeaseA, TLeaseB]]

NewUploader creates a decorator for object.Uploader that writes all objects to two replicas. If any inconsistencies between the backends are detected (e.g., the object is only present in one of the backends), they are repaired automatically.

Types

type Lease

type Lease[TLeaseA, TLeaseB any] struct {
	LeaseA TLeaseA
	LeaseB TLeaseB
}

Lease type that is returned by Uploader. It contains a pair of leases for each of the replicas.

Jump to

Keyboard shortcuts

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