Commit Graph

55 Commits

Author SHA1 Message Date
Steven Fackler
db462eb018 Avoid copies in copy_in
copy_in data was previously copied ~3 times - once into the copy_in
buffer, once more to frame it into a CopyData frame, and once to write
that into the stream.

Our Codec is now a bit more interesting. Rather than just writing out
pre-encoded data, we can also send along unencoded CopyData so they can
be framed directly into the stream output buffer. In the future we can
extend this to e.g. avoid allocating for simple commands like Sync.

This also allows us to directly pass large copy_in input directly
through without rebuffering it.
2019-06-25 18:54:17 -07:00
Steven Fackler
956ba12b54 Conversions from INET to IpAddr
We ignore the netmask when deserializing and use /32 or /128 when
serializing.

Closes #430
2019-04-03 21:30:49 -07:00
Steven Fackler
e549f8d635 Fix features 2019-03-05 21:47:34 -08:00
Steven Fackler
9e4f4d3496 More clippy 2019-03-05 18:26:55 -08:00
Steven Fackler
269197f743 Fix build 2019-03-04 22:22:51 -08:00
Steven Fackler
31534b5734 Fix serde docs 2019-03-04 21:51:44 -08:00
Steven Fackler
48af741192 Add a simple_query test 2019-01-31 20:47:42 -08:00
Steven Fackler
32e09dbb91 Change batch_execute into simple_query
Closes #413
2019-01-31 20:35:17 -08:00
Steven Fackler
d2723f5382 Don't conditionally compile config bits 2019-01-18 21:29:13 -08:00
Steven Fackler
725b7153b6 Move futures/streams to a submodule 2019-01-17 21:14:09 -08:00
Steven Fackler
b3fdf168e5 Add a warning about transaction semantics 2019-01-17 20:35:12 -08:00
Steven Fackler
2d3b9bb1c6 Move the TLS mode into config 2019-01-13 15:07:20 -08:00
Steven Fackler
5b045940f4 Rename handshake to connect_raw 2019-01-07 21:45:09 -08:00
Steven Fackler
364a19b0b3 Fix test 2019-01-07 21:19:09 -08:00
Steven Fackler
03d1a5aed3 Fix build 2019-01-07 21:10:15 -08:00
Steven Fackler
1f6d9ddc06 Overhaul query cancellation
Multi-host support means we can't simply take the old approach - we need
to know which of the hosts we actually connected to. It's also nice to
move this from the connection to the client since that's what you'd
normally have access to.
2019-01-06 18:03:51 -08:00
Steven Fackler
e0d113791c Rename raw cancel query 2019-01-06 11:33:22 -08:00
Steven Fackler
8dcad81224 Support URL-style configuration strings 2019-01-01 12:11:30 -08:00
Steven Fackler
a675b0b50a Accept a limited set of parameters in Config
This matches with libpq's behavior, which doesn't allow arbitrary
parameters. You can still set arbitrary parameters, just through the
`options` field.
2018-12-30 20:07:03 -08:00
Steven Fackler
45444d6c51 Support target_session_attrs
Closes #399
2018-12-30 11:50:15 -08:00
Steven Fackler
38db34eb6a Support TCP keepalive 2018-12-30 09:38:12 -08:00
Steven Fackler
9116147aee Rename Builder to Config 2018-12-29 21:00:58 -08:00
Steven Fackler
6ae93a0634 Add a convenience connect free function 2018-12-29 13:28:38 -08:00
Steven Fackler
635e6381b3 A less stringy builder
This allows us to support things like non-utf8 passwords and unix socket
directories.
2018-12-28 13:51:30 -05:00
Steven Fackler
be022b537c Fix poll_idle test race 2018-12-24 13:02:48 -05:00
Steven Fackler
1fdfefbeda Add Client::poll_idle
Closes #403
2018-12-22 17:02:48 -08:00
Steven Fackler
23b0d6e6f3 Support multiple hosts when connecting
cc #399
2018-12-19 20:18:48 -08:00
Steven Fackler
919012d0c9 Finish convenience API 2018-12-17 21:25:21 -08:00
Steven Fackler
7df7fc715b Start on runtime API 2018-12-16 22:00:46 -08:00
Steven Fackler
707b87a18e Fix parameter parsing and add test
Our behavior matches libpq's - in particular it allows any escape
sequence and trailing \'s...
2018-12-16 19:24:22 -08:00
Steven Fackler
7297661cef Shift tests down 2018-12-16 16:08:55 -08:00
Steven Fackler
46f4a2911c Deserialize libpq-style connection strings
Just the key/value pair version for now - URLs will come later
2018-12-13 21:03:47 -08:00
Steven Fackler
0db96ff62e Add back type tests 2018-12-09 16:19:45 -08:00
Steven Fackler
b4ce9c38e5 Upgrade tokio-postgres to 2018 edition 2018-12-08 17:52:20 -08:00
Steven Fackler
d58b1815ad Fix up new transaction API 2018-12-01 20:01:46 -08:00
Steven Fackler
a9b01b4807
Merge pull request #384 from DarrenTsung/transaction-builder
Add a TransactionBuilder struct
2018-12-01 19:56:44 -08:00
Steven Fackler
08b4020534 Overhaul connection APIs
* `Connection` is now parameterized over the stream type, which can be
    any `AsyncRead + AsyncWrite`.
* The `TlsMode` enum is now a trait, and `NoTls`, `PreferTls`, and
    `RequireTls` are types implementing that trait.
* The `TlsConnect` trait no longer involves trait objects, and returns
    channel binding info alongside the stream type rather than requiring
    the stream to implement an additional trait.
* The `connect` free function and `ConnectParams` type is gone in favor
    of a `Builder` type. It takes a pre-connected stream rather than
    automatically opening a TCP or Unix socket connection.

Notably, we no longer have any dependency on the Tokio runtime. We do
use the `tokio-codec` and `tokio-io` crates, but those don't actually
depend on mio/tokio-reactor/etc. This means we can work with other
futures-based networking stacks.

We will almost certainly add back a convenience API that offers
something akin to the old logic to open a TCP/Unix connection
automatically but that will be worked out in a follow up PR.
2018-11-28 19:20:40 -08:00
Darren Tsung
f3777bed76 Add a TransactionBuilder struct
The TransactionBuilder is useful when trying to create a Transaction
around a future which takes ownership of the client. See doc comment
for more details.
2018-11-06 10:14:32 -08:00
Steven Fackler
89f5198261 Add query_portal 2018-08-15 21:00:15 -07:00
Steven Fackler
a4bdcb11e4 Overhaul error type 2018-08-15 10:27:34 -07:00
Steven Fackler
bfd2c7f436 Fix assert 2018-08-12 20:49:59 -06:00
Steven Fackler
b74f5c80d0 copy in support 2018-08-12 20:19:27 -06:00
Steven Fackler
7056e3ec24 Copy out support 2018-07-15 19:40:15 -07:00
Steven Fackler
9e399aa93f Basic transaction support 2018-07-14 14:59:37 -07:00
Steven Fackler
bf0633681b Fix pipelined preparation
We can end up double-preparing the typeinfo queries if we're pipelining
preparation, so pick a unique name for them.
2018-07-08 16:06:53 -07:00
Steven Fackler
53657b828a Implement batch_execute 2018-07-07 22:42:04 -07:00
Steven Fackler
3955d26c20 Don't hold strong references in statements
There's no need for the connection to stay open until statements drop -
they'll be cleaned up anyway once the connection dies.
2018-07-07 16:43:07 -07:00
Steven Fackler
1788a03baa notification/notice support 2018-07-07 10:11:16 -07:00
Steven Fackler
a237a471c9 Support custom types 2018-07-05 20:48:08 -07:00
Steven Fackler
be2ca03fa9 tokio-postgres query cancellation 2018-06-27 22:37:43 -07:00