mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 05:30:24 +03:00
Add support for existing object replication. (#12109)
Also adding an API to allow resyncing replication when existing object replication is enabled and the remote target is entirely lost. With the `mc replicate reset` command, the objects that are eligible for replication as per the replication config will be resynced to target if existing object replication is enabled on the rule.
This commit is contained in:
committed by
GitHub
parent
1f262daf6f
commit
dbea8d2ee0
@@ -131,23 +131,31 @@ type Type int
|
||||
|
||||
// Types of replication
|
||||
const (
|
||||
ObjectReplicationType Type = 1 + iota
|
||||
UnsetReplicationType Type = 0 + iota
|
||||
ObjectReplicationType
|
||||
DeleteReplicationType
|
||||
MetadataReplicationType
|
||||
HealReplicationType
|
||||
ExistingObjectReplicationType
|
||||
)
|
||||
|
||||
// Valid returns true if replication type is set
|
||||
func (t Type) Valid() bool {
|
||||
return t > 0
|
||||
}
|
||||
|
||||
// ObjectOpts provides information to deduce whether replication
|
||||
// can be triggered on the resultant object.
|
||||
type ObjectOpts struct {
|
||||
Name string
|
||||
UserTags string
|
||||
VersionID string
|
||||
IsLatest bool
|
||||
DeleteMarker bool
|
||||
SSEC bool
|
||||
OpType Type
|
||||
Replica bool
|
||||
Name string
|
||||
UserTags string
|
||||
VersionID string
|
||||
IsLatest bool
|
||||
DeleteMarker bool
|
||||
SSEC bool
|
||||
OpType Type
|
||||
Replica bool
|
||||
ExistingObject bool
|
||||
}
|
||||
|
||||
// FilterActionableRules returns the rules actions that need to be executed
|
||||
@@ -191,6 +199,9 @@ func (c Config) Replicate(obj ObjectOpts) bool {
|
||||
if rule.Status == Disabled {
|
||||
continue
|
||||
}
|
||||
if obj.ExistingObject && rule.ExistingObjectReplication.Status == Disabled {
|
||||
return false
|
||||
}
|
||||
if obj.OpType == DeleteReplicationType {
|
||||
switch {
|
||||
case obj.VersionID != "":
|
||||
|
||||
Reference in New Issue
Block a user