code: func (c *Client) SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer,
  	replyFn structs.SnapshotReplyFn) error {
  	server := c.routers.FindServer()
  	if server == nil {
  		return structs.ErrNoServers
  	}
  
  	// Enforce the RPC limit.
  	metrics.IncrCounter([]string{"client", "rpc"}, 1)
  	if !c.rpcLimiter.Load().(*rate.Limiter).Allow() {
  		metrics.IncrCounter([]string{"client", "rpc", "exceeded"}, 1)
  		return structs.ErrRPCRateExceeded
  	}
  
  	// Request the operation.
  	var reply structs.SnapshotResponse
  	snap, err := SnapshotRPC(c.connPool, c.config.Datacenter, server.Addr, server.UseTLS, args, in, &reply)
  	if err != nil {
  		return err
  	}
  	defer func() {
  		if err := snap.Close(); err != nil {
  			c.logger.Printf("[WARN] consul: Failed closing snapshot stream: %v", err)
  		}
  	}()
  
  	// Let the caller peek at the reply.
  	if replyFn != nil {
  		if err := replyFn(&reply); err != nil {
  			return nil
  		}
  	}
  
  	// Stream the snapshot.
  	if out != nil {
  		if _, err := io.Copy(out, snap); err != nil {
  			return fmt.Errorf("failed to stream snapshot: %v", err)
  		}
  	}
  
  	return nil
  }
docs: // SnapshotRPC sends the snapshot request to one of the servers, reading from
  // the streaming input and writing to the streaming output depending on the
  // operation.