replication

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type And

type And struct {
	XMLName xml.Name `xml:"And,omitempty" json:"-"`
	Prefix  string   `xml:"Prefix,omitempty" json:"Prefix,omitempty"`
	Tags    []Tag    `xml:"Tag,omitempty" json:"Tag,omitempty"`
}

And - a tag to combine a prefix and multiple tags for replication configuration rule.

type Config

type Config struct {
	XMLName xml.Name `xml:"ReplicationConfiguration" json:"-"`
	Rules   []Rule   `xml:"Rule" json:"Rules"`
	Role    string   `xml:"Role" json:"Role"`
}

Config - replication configuration specified in https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html

func (*Config) AddRule

func (c *Config) AddRule(opts Options) error

AddRule adds a new rule to existing replication config. If a rule exists with the same ID, then the rule is replaced.

func (*Config) EditRule

func (c *Config) EditRule(opts Options) error

EditRule modifies an existing rule in replication config

func (*Config) Empty

func (c *Config) Empty() bool

Empty returns true if config is not set

func (*Config) RemoveRule

func (c *Config) RemoveRule(opts Options) error

RemoveRule removes a rule from replication config.

type DeleteMarkerReplication

type DeleteMarkerReplication struct {
	Status Status `xml:"Status" json:"Status"` // should be set to "Disabled" by default
}

DeleteMarkerReplication - whether delete markers are replicated - https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html

func (DeleteMarkerReplication) IsEmpty

func (d DeleteMarkerReplication) IsEmpty() bool

IsEmpty returns true if DeleteMarkerReplication is not set

type DeleteReplication

type DeleteReplication struct {
	Status Status `xml:"Status" json:"Status"` // should be set to "Disabled" by default
}

DeleteReplication - whether versioned deletes are replicated - this is a MinIO specific extension

func (DeleteReplication) IsEmpty

func (d DeleteReplication) IsEmpty() bool

IsEmpty returns true if DeleteReplication is not set

type Destination

type Destination struct {
	XMLName      xml.Name `xml:"Destination" json:"-"`
	Bucket       string   `xml:"Bucket" json:"Bucket"`
	StorageClass string   `xml:"StorageClass,omitempty" json:"StorageClass,omitempty"`
}

Destination - destination in ReplicationConfiguration.

type ExistingObjectReplication

type ExistingObjectReplication struct {
	Status Status `xml:"Status"` // should be set to "Disabled" by default
}

ExistingObjectReplication - whether existing object replication is enabled

func (ExistingObjectReplication) IsEmpty

func (e ExistingObjectReplication) IsEmpty() bool

IsEmpty returns true if DeleteMarkerReplication is not set

func (ExistingObjectReplication) Validate

func (e ExistingObjectReplication) Validate() error

Validate validates whether the status is disabled.

type Filter

type Filter struct {
	XMLName xml.Name `xml:"Filter" json:"-"`
	Prefix  string   `json:"Prefix,omitempty"`
	And     And      `xml:"And,omitempty" json:"And,omitempty"`
	Tag     Tag      `xml:"Tag,omitempty" json:"Tag,omitempty"`
}

Filter - a filter for a replication configuration Rule.

func (Filter) Validate

func (f Filter) Validate() error

Validate - validates the filter element

type Metrics

type Metrics struct {
	Stats map[string]TargetMetrics
	// Total Pending size in bytes across targets
	PendingSize uint64 `json:"pendingReplicationSize"`
	// Completed size in bytes  across targets
	ReplicatedSize uint64 `json:"completedReplicationSize"`
	// Total Replica size in bytes  across targets
	ReplicaSize uint64 `json:"replicaSize"`
	// Failed size in bytes  across targets
	FailedSize uint64 `json:"failedReplicationSize"`
	// Total number of pending operations including metadata updates across targets
	PendingCount uint64 `json:"pendingReplicationCount"`
	// Total number of failed operations including metadata updates across targets
	FailedCount uint64 `json:"failedReplicationCount"`
}

Metrics represents inline replication metrics for a bucket.

type OptionType

type OptionType string

OptionType specifies operation to be performed on config

const (
	// AddOption specifies addition of rule to config
	AddOption OptionType = "Add"
	// SetOption specifies modification of existing rule to config
	SetOption OptionType = "Set"

	// RemoveOption specifies rule options are for removing a rule
	RemoveOption OptionType = "Remove"
	// ImportOption is for getting current config
	ImportOption OptionType = "Import"
)

type Options

type Options struct {
	Op                      OptionType
	RoleArn                 string
	ID                      string
	Prefix                  string
	RuleStatus              string
	Priority                string
	TagString               string
	StorageClass            string
	DestBucket              string
	IsTagSet                bool
	IsSCSet                 bool
	ReplicateDeletes        string // replicate versioned deletes
	ReplicateDeleteMarkers  string // replicate soft deletes
	ReplicaSync             string // replicate replica metadata modifications
	ExistingObjectReplicate string
}

Options represents options to set a replication configuration rule

func (Options) Tags

func (opts Options) Tags() ([]Tag, error)

Tags returns a slice of tags for a rule

type ReplicaModifications

type ReplicaModifications struct {
	Status Status `xml:"Status" json:"Status"` // should be set to "Enabled" by default
}

ReplicaModifications specifies if replica modification sync is enabled

type ResyncTarget

type ResyncTarget struct {
	Arn       string    `json:"arn"`
	ResetID   string    `json:"resetid"`
	StartTime time.Time `json:"startTime,omitempty"`
	EndTime   time.Time `json:"endTime,omitempty"`
	// Status of resync operation
	ResyncStatus string `json:"resyncStatus,omitempty"`
	// Completed size in bytes
	ReplicatedSize int64 `json:"completedReplicationSize,omitempty"`
	// Failed size in bytes
	FailedSize int64 `json:"failedReplicationSize,omitempty"`
	// Total number of failed operations
	FailedCount int64 `json:"failedReplicationCount,omitempty"`
	// Total number of failed operations
	ReplicatedCount int64 `json:"replicationCount,omitempty"`
	// Last bucket/object replicated.
	Bucket string `json:"bucket,omitempty"`
	Object string `json:"object,omitempty"`
}

ResyncTarget provides the replica resources and resetID to initiate resync replication.

type ResyncTargetsInfo

type ResyncTargetsInfo struct {
	Targets []ResyncTarget `json:"target,omitempty"`
}

ResyncTargetsInfo provides replication target information to resync replicated data.

type Rule

type Rule struct {
	XMLName                   xml.Name                  `xml:"Rule" json:"-"`
	ID                        string                    `xml:"ID,omitempty"`
	Status                    Status                    `xml:"Status"`
	Priority                  int                       `xml:"Priority"`
	DeleteMarkerReplication   DeleteMarkerReplication   `xml:"DeleteMarkerReplication"`
	DeleteReplication         DeleteReplication         `xml:"DeleteReplication"`
	Destination               Destination               `xml:"Destination"`
	Filter                    Filter                    `xml:"Filter" json:"Filter"`
	SourceSelectionCriteria   SourceSelectionCriteria   `xml:"SourceSelectionCriteria" json:"SourceSelectionCriteria"`
	ExistingObjectReplication ExistingObjectReplication `xml:"ExistingObjectReplication,omitempty" json:"ExistingObjectReplication,omitempty"`
}

Rule - a rule for replication configuration.

func (Rule) Prefix

func (r Rule) Prefix() string

Prefix - a rule can either have prefix under <filter></filter> or under <filter><and></and></filter>. This method returns the prefix from the location where it is available

func (Rule) Tags

func (r Rule) Tags() string

Tags - a rule can either have tag under <filter></filter> or under <filter><and></and></filter>. This method returns all the tags from the rule in the format tag1=value1&tag2=value2

func (Rule) Validate

func (r Rule) Validate() error

Validate validates the rule for correctness

type SourceSelectionCriteria

type SourceSelectionCriteria struct {
	ReplicaModifications ReplicaModifications `xml:"ReplicaModifications" json:"ReplicaModifications"`
}

SourceSelectionCriteria - specifies additional source selection criteria in ReplicationConfiguration.

func (SourceSelectionCriteria) IsValid

func (s SourceSelectionCriteria) IsValid() bool

IsValid - checks whether SourceSelectionCriteria is valid or not.

func (SourceSelectionCriteria) Validate

func (s SourceSelectionCriteria) Validate() error

Validate source selection criteria

type Status

type Status string

Status represents Enabled/Disabled status

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

Supported status types

type Tag

type Tag struct {
	XMLName xml.Name `json:"-"`
	Key     string   `xml:"Key,omitempty" json:"Key,omitempty"`
	Value   string   `xml:"Value,omitempty" json:"Value,omitempty"`
}

Tag - a tag for a replication configuration Rule filter.

func (Tag) IsEmpty

func (tag Tag) IsEmpty() bool

IsEmpty returns whether this tag is empty or not.

func (Tag) String

func (tag Tag) String() string

func (Tag) Validate

func (tag Tag) Validate() error

Validate checks this tag.

type TargetMetrics

type TargetMetrics struct {
	// Pending size in bytes
	PendingSize uint64 `json:"pendingReplicationSize"`
	// Completed size in bytes
	ReplicatedSize uint64 `json:"completedReplicationSize"`
	// Total Replica size in bytes
	ReplicaSize uint64 `json:"replicaSize"`
	// Failed size in bytes
	FailedSize uint64 `json:"failedReplicationSize"`
	// Total number of pending operations including metadata updates
	PendingCount uint64 `json:"pendingReplicationCount"`
	// Total number of failed operations including metadata updates
	FailedCount uint64 `json:"failedReplicationCount"`
}

TargetMetrics represents inline replication metrics such as pending, failed and completed bytes in total for a bucket remote target

Jump to

Keyboard shortcuts

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