github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/vendor_skip/go.mongodb.org/mongo-driver/x/mongo/driver/DESIGN.md (about)

     1  # Driver Library Design
     2  This document outlines the design for this package.
     3  
     4  ## Deployment, Server, and Connection
     5  Acquiring a `Connection` from a `Server` selected from a `Deployment` enables sending and receiving
     6  wire messages. A `Deployment` represents an set of MongoDB servers and a `Server` represents a
     7  member of that set. These three types form the operation execution stack.
     8  
     9  ### Compression
    10  Compression is handled by Connection type while uncompression is handled automatically by the
    11  Operation type. This is done because the compressor to use for compressing a wire message is
    12  chosen by the connection during handshake, while uncompression can be performed without this
    13  information. This does make the design of compression non-symmetric, but it makes the design simpler
    14  to implement and more consistent.
    15  
    16  ## Operation
    17  The `Operation` type handles executing a series of commands using a `Deployment`. For most uses
    18  `Operation` will only execute a single command, but the main use case for a series of commands is
    19  batch split write commands, such as insert. The type itself is heavily documented, so reading the
    20  code and comments together should provide an understanding of how the type works.
    21  
    22  This type is not meant to be used directly by callers. Instead a wrapping type should be defined
    23  using the IDL.