Types
Connection[TheSocket] {..} = object socket*: TheSocket ## Socket which used for sending/receiving Bson. id*: int ## Identifier which used in pool for socket availability.
- Connection is an object representation of a single asyncsocket and its identifier. Source Edit
Procs
proc `[]`[T: MultiSock](p: Pool[T]; i: int): lent Connection[T]
- Retrieve the i-th connection object in a pool. Source Edit
proc `[]=`[T: MultiSock](p: Pool; i: int; c: Connection[T])
- Set the i-th connection object with c. Source Edit
proc authenticate(p: Pool[AsyncSocket]; user, pass: string; T: typedesc = Sha256Digest; dbname = "admin.$cmd"): Future[ bool] {....stackTrace: false.}
- Authenticate all connections in a pool with supplied username, password, type which default to SHA256Digest, and database which default to "admin". Type receives SHA1Digest as other typedesc. Currently this taking too long for large pool connections. Source Edit
proc authenticate(p: Pool[Socket]; user, pass: string; T: typedesc = Sha256Digest; dbname = "admin.$cmd"): bool
- Authenticate all connections in a pool with supplied username, password, type which default to SHA256Digest, and database which default to "admin". Type receives SHA1Digest as other typedesc. Currently this taking too long for large pool connections. Source Edit
proc connections[T: MultiSock](p: Pool[T]): lent TableRef[int, Connection[T]]
- Retrieve the connections table. Source Edit
proc getConn(p: Pool[AsyncSocket]): Future[(int, Connection[AsyncSocket])] {. ...stackTrace: false, raises: [Exception, ValueError], tags: [RootEffect, TimeEffect], forbids: [].}
- Retrieve a random connection with its id in async. In case no available queues in the pool, it will poll whether any other connections will be available soon. Source Edit
proc getConn(p: Pool[Socket]): (int, Connection[Socket]) {....raises: [KeyError], tags: [], forbids: [].}
- Source Edit
proc initConnection[T: MultiSock](id = 0): Connection[T]
- Init for a connection. Source Edit