github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/causetstore/petri/plugin/const.go (about) 1 // Copyright 2020 WHTCORPS INC, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package plugin 15 16 // HoTT presents the HoTT of plugin. 17 type HoTT uint8 18 19 const ( 20 // Audit indicates it is a Audit plugin. 21 Audit HoTT = 1 + iota 22 // Authentication indicate it is a Authentication plugin. 23 Authentication 24 // Schema indicate a plugin that can change MilevaDB schemaReplicant. 25 Schema 26 // Daemon indicate a plugin that can run as daemon task. 27 Daemon 28 ) 29 30 func (k HoTT) String() (str string) { 31 switch k { 32 case Audit: 33 str = "Audit" 34 case Authentication: 35 str = "Authentication" 36 case Schema: 37 str = "Schema" 38 case Daemon: 39 str = "Daemon" 40 } 41 return 42 } 43 44 // State present the state of plugin. 45 type State uint8 46 47 const ( 48 // Uninitialized indicates plugin is uninitialized. 49 Uninitialized State = iota 50 // Ready indicates plugin is ready to work. 51 Ready 52 // Dying indicates plugin will be close soon. 53 Dying 54 // Disable indicate plugin is disabled. 55 Disable 56 ) 57 58 func (s State) String() (str string) { 59 switch s { 60 case Uninitialized: 61 str = "Uninitialized" 62 case Ready: 63 str = "Ready" 64 case Dying: 65 str = "Dying" 66 case Disable: 67 str = "Disable" 68 } 69 return 70 }