Class: Mongo::Crypt::Status Private
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/mongo/crypt/status.rb |
Overview
A wrapper around mongocrypt_status_t, representing the status of a mongocrypt_t handle.
Class Method Summary
-
.from_pointer(pointer) ⇒ Mongo::Crypt::Status
Internal use only
Initialize a
Status
object from an existing pointer to a mongocrypt_status_t object. -
.new(pointer: nil) ⇒ Status
constructor
Internal use only
Create a new
Status
object.
Instance Attribute Summary
-
#ok? ⇒ Boolean
readonly
Internal use only
Checks whether the status is labeled
:ok
.
Instance Method Summary
-
#code ⇒ Integer
Internal use only
Return the integer code associated with the status.
-
#label ⇒ Symbol
Internal use only
Return the label of the status.
-
#message ⇒ String
Internal use only
Return the status message.
-
#raise_crypt_error(kms: false)
Internal use only
Raises a Mongo::Error:CryptError corresponding to the information stored in this status.
-
#ref ⇒ FFI::Pointer
Internal use only
Returns the reference to the underlying mongocrypt_status_t object.
-
#update(label, code, message) ⇒ Mongo::Crypt::Status
Internal use only
Set a label, code, and message on the
Status
.
Class Method Details
.from_pointer(pointer) ⇒ Status
Initialize a Status
object from an existing pointer to a mongocrypt_status_t object.
# File 'lib/mongo/crypt/status.rb', line 54
def self.from_pointer(pointer) self.new(pointer: pointer) end
Instance Attribute Details
#ok? ⇒ Boolean
(readonly)
Checks whether the status is labeled :ok
# File 'lib/mongo/crypt/status.rb', line 105
def ok? Binding.mongocrypt_status_ok(@status) end
Instance Method Details
#code ⇒ Integer
Return the integer code associated with the status
# File 'lib/mongo/crypt/status.rb', line 90
def code Binding.mongocrypt_status_code(@status) end
#label ⇒ Symbol
Return the label of the status
# File 'lib/mongo/crypt/status.rb', line 83
def label Binding.mongocrypt_status_type(@status) end
#message ⇒ String
Return the status message
# File 'lib/mongo/crypt/status.rb', line 97
def = Binding. (@status, nil) || '' end
#raise_crypt_error(kms: false)
#ref ⇒ FFI::Pointer
Returns the reference to the underlying mongocrypt_status_t object
# File 'lib/mongo/crypt/status.rb', line 113
def ref @status end
#update(label, code, message) ⇒ Status
Set a label, code, and message on the Status
# File 'lib/mongo/crypt/status.rb', line 65
def update(label, code, ) unless [:ok, :error_client, :error_kms].include?(label) raise ArgumentError.new( "#{label} is an invalid value for a Mongo::Crypt::Status label. " + "Label must have one of the following values: :ok, :error_client, :error_kms" ) end = ? .bytesize + 1 : 0 Binding.mongocrypt_status_set(@status, label, code, , ) self end