replication

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package replication provides replication configuration and metrics types.

Package replication provides replication metrics types.

Package replication provides bucket replication configuration types and helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = ReplicationConfig

Config is an alias for ReplicationConfig.

type Destination

type Destination struct {
	Bucket       string `xml:"Bucket"`
	StorageClass string `xml:"StorageClass,omitempty"`
}

Destination defines the replication target.

type Filter

type Filter struct {
	Prefix string `xml:"Prefix,omitempty"`
	Tag    Tag    `xml:"Tag,omitempty"`
}

Filter restricts which objects are replicated.

type Metrics

type Metrics struct {
	Stats           map[string]TargetMetrics `json:"Stats,omitempty"`
	ReplicatedSize  uint64                   `json:"completedReplicationSize,omitempty"`
	ReplicaSize     uint64                   `json:"replicaSize,omitempty"`
	ReplicaCount    int64                    `json:"replicaCount,omitempty"`
	ReplicatedCount int64                    `json:"replicationCount,omitempty"`
	Errors          TimedErrStats            `json:"failed,omitempty"`
	PendingSize     uint64                   `json:"pendingReplicationSize,omitempty"`
	FailedSize      uint64                   `json:"failedReplicationSize,omitempty"`
	PendingCount    uint64                   `json:"pendingReplicationCount,omitempty"`
	FailedCount     uint64                   `json:"failedReplicationCount,omitempty"`
}

Metrics represents replication metrics for a bucket.

type RStat

type RStat struct {
	Count float64 `json:"count"`
	Bytes int64   `json:"bytes"`
}

RStat holds count and bytes for replication metrics.

type ReplicationConfig added in v1.0.5

type ReplicationConfig struct {
	XMLNS   string   `xml:"xmlns,attr,omitempty"`
	XMLName xml.Name `xml:"ReplicationConfiguration"`
	Role    string   `xml:"Role,omitempty"`
	Rules   []Rule   `xml:"Rule"`
}

ReplicationConfig represents a bucket replication configuration.

func ParseConfig added in v1.0.5

func ParseConfig(reader io.Reader) (ReplicationConfig, error)

ParseConfig parses replication configuration XML from a reader.

func (*ReplicationConfig) Normalize added in v1.0.5

func (c *ReplicationConfig) Normalize() error

Normalize validates and normalizes the replication configuration.

func (ReplicationConfig) ToXML added in v1.0.5

func (c ReplicationConfig) ToXML() ([]byte, error)

ToXML marshals the replication configuration to XML.

type Rule

type Rule struct {
	ID          string      `xml:"ID,omitempty"`
	Status      Status      `xml:"Status"`
	Priority    int         `xml:"Priority,omitempty"`
	Filter      Filter      `xml:"Filter,omitempty"`
	Destination Destination `xml:"Destination"`
}

Rule defines a replication rule.

type Status

type Status string

Status represents replication rule status.

const (
	Enabled  Status = "Enabled"
	Disabled Status = "Disabled"
)

type Tag

type Tag struct {
	Key   string `xml:"Key,omitempty"`
	Value string `xml:"Value,omitempty"`
}

Tag is a key/value pair for replication filtering.

type TargetMetrics

type TargetMetrics struct {
	ReplicatedCount                  uint64        `json:"replicationCount,omitempty"`
	ReplicatedSize                   uint64        `json:"completedReplicationSize,omitempty"`
	BandWidthLimitInBytesPerSecond   int64         `json:"limitInBits,omitempty"`
	CurrentBandwidthInBytesPerSecond float64       `json:"currentBandwidth,omitempty"`
	Failed                           TimedErrStats `json:"failed,omitempty"`
	PendingSize                      uint64        `json:"pendingReplicationSize,omitempty"`
	ReplicaSize                      uint64        `json:"replicaSize,omitempty"`
	FailedSize                       uint64        `json:"failedReplicationSize,omitempty"`
	PendingCount                     uint64        `json:"pendingReplicationCount,omitempty"`
	FailedCount                      uint64        `json:"failedReplicationCount,omitempty"`
}

TargetMetrics represents replication metrics for a single target.

type TimedErrStats

type TimedErrStats struct {
	LastMinute RStat `json:"lastMinute"`
	LastHour   RStat `json:"lastHour"`
	Totals     RStat `json:"totals"`
}

TimedErrStats holds error stats for a time period.

Jump to

Keyboard shortcuts

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