github.com/minio/mc@v0.0.0-20240503112107-b471de8d1882/cmd/urls.go (about) 1 // Copyright (c) 2015-2022 MinIO, Inc. 2 // 3 // This file is part of MinIO Object Storage stack 4 // 5 // This program is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Affero General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Affero General Public License for more details. 14 // 15 // You should have received a copy of the GNU Affero General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 package cmd 19 20 import ( 21 "github.com/minio/mc/pkg/probe" 22 ) 23 24 // URLs contains source and target urls 25 type URLs struct { 26 SourceAlias string 27 SourceContent *ClientContent 28 TargetAlias string 29 TargetContent *ClientContent 30 TotalCount int64 31 TotalSize int64 32 MD5 bool 33 DisableMultipart bool 34 encKeyDB map[string][]prefixSSEPair 35 Error *probe.Error `json:"-"` 36 ErrorCond differType `json:"-"` 37 } 38 39 // WithError sets the error and returns object 40 func (m URLs) WithError(err *probe.Error) URLs { 41 m.Error = err 42 return m 43 } 44 45 // Equal tests if both urls are equal 46 func (m URLs) Equal(n URLs) bool { 47 if m.SourceContent != nil && n.SourceContent == nil { 48 return false 49 } else if m.SourceContent == nil && n.SourceContent != nil { 50 return false 51 } else if m.SourceContent.URL != n.SourceContent.URL { 52 return false 53 } 54 55 if m.TargetContent != nil && n.TargetContent == nil { 56 return false 57 } else if m.TargetContent == nil && n.TargetContent != nil { 58 return false 59 } else if m.TargetContent.URL != n.TargetContent.URL { 60 return false 61 } 62 63 return true 64 }