github.com/annchain/OG@v0.0.9/og/protocol/ogmessage/archive/verify.go (about) 1 package archive 2 3 type VerifiedType byte 4 5 const ( 6 VerifiedNone VerifiedType = iota 7 VerifiedFormat 8 VerifiedGraph 9 VerifiedFormatAndGraph 10 ) 11 12 func (t VerifiedType) String() string { 13 switch t { 14 case VerifiedNone: 15 return "None" 16 case VerifiedFormat: 17 return "Format" 18 case VerifiedGraph: 19 return "Graph" 20 case VerifiedFormatAndGraph: 21 return "FormatGraph" 22 default: 23 return "None" 24 } 25 } 26 27 func (t VerifiedType) IsFormatVerified() bool { 28 if t == VerifiedFormat || t == VerifiedFormatAndGraph { 29 return true 30 } 31 return false 32 } 33 34 func (t VerifiedType) IsGraphVerified() bool { 35 if t == VerifiedGraph || t == VerifiedFormatAndGraph { 36 return true 37 } 38 return false 39 } 40 41 func (t VerifiedType) Merge(v VerifiedType) VerifiedType { 42 if v == VerifiedFormat { 43 if t == VerifiedGraph { 44 return VerifiedFormatAndGraph 45 } 46 return VerifiedFormat 47 } else if v == VerifiedGraph { 48 if t == VerifiedFormat { 49 return VerifiedFormatAndGraph 50 } 51 return VerifiedGraph 52 } 53 //for test , never come here 54 return VerifiedNone 55 }