replica

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Replica

type Replica struct {
	// ID is the identifier of the replica
	ID string

	// OriginalCount it's the original number of replicas
	OriginalCount int

	// Count it's the number of missing replicas
	Count int

	// Key is the key to replicate
	Key string

	// Signature is the signature of the file
	Signature string

	// VolumeID that stored the original replica
	VolumeID string

	// VolumeIDs list of all the volumes that have the replica
	// excluding the original one
	VolumeIDs []string

	// VolumeReplicaID represents the unique ID of the replica
	// inside the Volume. It's used to index in a
	// unique increase order on the DB
	VolumeReplicaID []byte

	// TTL is the duration the original file has
	TTL time.Duration

	// CreatedAt is the time of creation of the original file
	CreatedAt time.Time
}

Replica is the struct holding a pending file to replicate

type Repository

type Repository interface {
	// Create stores the Pendent
	Create(ctx context.Context, r *Replica) error

	// First gets the first element
	First(ctx context.Context) (*Replica, error)

	// Delete removes the Pendent
	Delete(ctx context.Context, r *Replica) error

	DeleteAll(ctx context.Context) error

	// HasAny returns true if there is at least one replica in the queue
	HasAny(ctx context.Context) (bool, error)

	// HasKey returns true if there is already a pending replica job for the given file key.
	HasKey(ctx context.Context, key string) (bool, error)
}

Repository is the interface that defines which actions can be done to the Pendent struct

Jump to

Keyboard shortcuts

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