123456789_123456789_123456789_123456789_123456789_

Class: Mongo::Crypt::AutoEncryptionContext Private

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Context, Forwardable
Instance Chain:
self, Context
Inherits: Mongo::Crypt::Context
Defined in: lib/mongo/crypt/auto_encryption_context.rb

Overview

A Context object initialized for auto encryption

Class Method Summary

Context - Inherited

.new

Create a new Context object.

Instance Attribute Summary

Context - Inherited

Instance Method Summary

Context - Inherited

#bson_mode

Which BSON mode to use when creating documents from the outcome of the state machine.

#run_state_machine

Runs the mongocrypt_ctx_t state machine and handles all I/O on behalf of.

#state

Returns the state of the mongocrypt_ctx_t.

#azure_access_token

Returns an Azure access token, retrieving it if necessary.

#feed_collection_info, #feed_kms,
#gcp_access_token

Retrieves a GCP access token.

#mongocrypt_done

Indicate that state machine is done feeding I/O responses back to libmongocrypt.

#mongocrypt_feed

Feeds the result of a ::Mongo operation back to libmongocrypt.

#provide_collection_info, #provide_collection_info_with_db, #provide_keys, #provide_markings,
#retrieve_kms_credentials

Retrieves KMS credentials for providers that are configured for automatic credentials retrieval.

Constructor Details

.new(mongocrypt, io, db_name, command) ⇒ AutoEncryptionContext

Create a new AutoEncryptionContext object

Parameters:

  • mongocrypt (Mongo::Crypt::Handle)

    a Handle that wraps a mongocrypt_t object used to create a new mongocrypt_ctx_t

  • io (ClientEncryption::IO)

    A instance of the IO class that implements driver I/O methods required to run the state machine

  • db_name (String)

    The name of the database against which the command is being made

  • command (Hash)

    The command to be encrypted

[ GitHub ]

  
# File 'lib/mongo/crypt/auto_encryption_context.rb', line 33

def initialize(mongocrypt, io, db_name, command)
  super(mongocrypt, io)

  @db_name = db_name
  @command = command

  # Initialize the ctx object for auto encryption
  Binding.ctx_encrypt_init(self, @db_name, @command)
end