github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/vendor_skip/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/state.go (about) 1 // Copyright (C) MongoDB, Inc. 2017-present. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may 4 // not use this file except in compliance with the License. You may obtain 5 // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 7 package mongocrypt 8 9 // State represents a state that a MongocryptContext can be in. 10 type State int 11 12 // These constants are valid values for the State type. 13 // The values must match the values defined in the mongocrypt_ctx_state_t enum in libmongocrypt. 14 const ( 15 StateError State = 0 16 NeedMongoCollInfo State = 1 17 NeedMongoMarkings State = 2 18 NeedMongoKeys State = 3 19 NeedKms State = 4 20 Ready State = 5 21 Done State = 6 22 NeedKmsCredentials State = 7 23 ) 24 25 // String implements the Stringer interface. 26 func (s State) String() string { 27 switch s { 28 case StateError: 29 return "Error" 30 case NeedMongoCollInfo: 31 return "NeedMongoCollInfo" 32 case NeedMongoMarkings: 33 return "NeedMongoMarkings" 34 case NeedMongoKeys: 35 return "NeedMongoKeys" 36 case NeedKms: 37 return "NeedKms" 38 case Ready: 39 return "Ready" 40 case Done: 41 return "Done" 42 case NeedKmsCredentials: 43 return "NeedKmsCredentials" 44 default: 45 return "Unknown State" 46 } 47 }