Commit Graph

35 Commits

Author SHA1 Message Date
zhangxiaoyu.york 662573b6bf
feature:support ipv6 address (#280)
Problem Summary:
Now the etcd client address do not support host format such as
http://[ipv6]:port.

and [RFC
3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2)
```
A host identified by an Internet Protocol literal address, version 6
[[RFC3513](https://datatracker.ietf.org/doc/html/rfc3513)] or later, is distinguished by enclosing the IP literal
within square brackets ("[" and "]").  This is the only place where
square bracket characters are allowed in the URI syntax.  In
anticipation of future, as-yet-undefined IP literal address formats,
an implementation may use an optional version flag to indicate such a
format explicitly rather than rely on heuristic determination.

      IP-literal = "[" ( IPv6address / IPvFuture  ) "]"
```
the ipv6 address is distinguished by enclosing the IP literal within
square brackets ("[" and "]").

What is changed and how it works:
if we find the host part of a URL starts with a "[" and ends with a "]".
it will be specifically judged whether it is a valid IPv6 address. If it
is a valid address, it can be returned directly without call the
`getaddrinfo` interface.
2024-11-12 10:13:53 +08:00
Ye Cao 3ad17314d6
Add the cluster manager api. (#276)
As titled.

Signed-off-by: Ye Cao <caoye.cao@alibaba-inc.com>
2024-08-02 10:30:43 +08:00
Tao He 5ccaccec43
Enable ipv6 endpoints support (#262)
Resolves #250

Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
2023-12-20 17:56:18 +08:00
Tao He b82efea7a9
Enable -fno-exceptions support (#261)
Resolves #259

Signed-off-by: Tao He <sighingnow@gmail.com>
2023-12-20 09:18:10 +08:00
Tao He 5aff57cce5
Fixes the noisy logs when meets invalid addresses. (#260)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-12-20 00:32:00 +08:00
Diskein 59635008c0
Fixes compiler errors (#254)
Co-authored-by: Denis Kalantaevsky <dkalantaevsky@gmail.com>
Co-authored-by: Tao He <sighingnow@gmail.com>
2023-10-05 22:59:06 -05:00
JonLiu1993 e5dc903a5d
Fix error LNK1107 and undeclared identifier 'IPPROTO_TCP' (#244)
When I [Update](https://github.com/microsoft/vcpkg/pull/32747)
etcd-cpp-apiv3 version from 0.14.2 to 0.15.2, I get two build error:
````
fatal error LNK1107: invalid or corrupt file: cannot read at 0x330
````
````
error: use of undeclared identifier 'IPPROTO_TCP'
````

The first error was because the target `etcd-cpp-api-core-objects`
linked the wrong `libprotobufd.dll` file instead of the .lib file, I
used the usage provided by vcpkg to link the correct .lib file to fix
this error.

Another error was because `IPPROTO_TCP` was missing declaration
`"<netinet/in.h>"`, I added it to fix this error.

---------

Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
Co-authored-by: Zhao Liu <v-zhli17@microsoft.com>
Co-authored-by: Tao He <linzhu.ht@alibaba-inc.com>
2023-07-27 11:27:19 +08:00
Tao He 153546f965
Refactor the implementation of etcd transactions. (#236)
Fixes #234.

Signed-off-by: Tao He <sighingnow@gmail.com>
2023-07-15 17:07:34 +08:00
Tao He 1d5128a7e8
Format source code using clformat (#233)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-07-01 20:49:16 +08:00
Tao He 0ed7bee2c8
Merge the .hpp/.cpp into one to optimize build time (#220)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-05-11 14:09:41 +08:00
Tao He e771d2f6da
Drop the boost dependency on the sync runtime (#216)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-04-28 20:38:13 +08:00
Tao He ebf9c493f1
Get and list keys with specified revision. (#215)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-04-26 21:06:23 +08:00
Tao He fb41073a90
Reliable macro condition to adapt to different version of gRPC. (#187) 2023-01-31 12:52:19 +08:00
Tao He 10f3435c28
Enable keys() to list elements without fetching values from server (#184)
* Enable keys() to list elements without fetching values from server
* Add concurrency control and cancel to CI workflows

Signed-off-by: Tao He <sighingnow@gmail.com>
2023-01-10 15:00:34 +08:00
Tao He 9f09066b47
Fixes the timeout parameter and some improvements to find non-standard installed deps. (#178)
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-10-17 13:18:36 +08:00
Tao He 1fb5abac28
Implements the "etcdctl lease list" functionality (#174)
* Implements the "etcdctl lease list" functionalities.
* LeaseLeases requires etcd >= 3.3

Signed-off-by: Tao He <sighingnow@gmail.com>
2022-10-13 00:04:18 +08:00
Tao He ab255467d0
Taking error code from grpc. (#172)
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-10-09 10:25:50 +08:00
Tao He 89ae8a5ee4 Define "NOMINMAX" to ensure `<limits>` works.
See also: https://stackoverflow.com/questions/2561368/illegal-token-on-right-side-of

Resolves #149.

Signed-off-by: Tao He <sighingnow@gmail.com>
2022-08-17 11:34:28 +08:00
Tao He ca2553e30d
Enable C++11 when testing grpc features. (#146)
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-07-31 16:58:53 +08:00
Tao He 2ed6cacce9
Add more variants for etcd::Watcher's constructor. (#144)
* Add more variants for etcd::Watcher's constructor.
* Use ASAN for testing on CI.
* Revert "Use ASAN for testing on CI."

This reverts commit 6ccc2161da.
2022-07-19 20:42:44 +08:00
Tao He 2437a08e72 No timeout for leaserevoke.
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-05-23 15:13:47 +08:00
Tao He e5f1167c69 Implements the timeout feature to the etcd client.
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-05-22 22:57:38 +08:00
Tao He 8da8946409 Refactor the implementation of sync-client and async-client.
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-05-22 21:42:06 +08:00
Tao He 345380a83a
Allow specifying the auth token TTL when auth with password. (#109)
* Allow specifying the auth token TTL when auth with password.
* Fixes.

Resolves #107.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-12-22 14:30:45 +08:00
Tao He 405383c0ba Add a new API to `client.observe()` that accepts a callback.
Resolves #108.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-12-22 10:30:46 +08:00
Matthew Fioravante 1118222b3d
Make revision numbers 64 bit to match proto spec (#96)
* Make Response::index() 64 bit

* make compact_revision 64 bit

* Make input revision params 64 bit

* make Transaction mod revision 64 bit

* Make Value created and modified index 64 bit

* Fix tests
2021-10-27 10:51:49 +08:00
Tao He d29e05545d Implements the put action.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-10-12 10:17:25 +08:00
Tao He cda80854eb
Implements "v3election.proto" APIs. (#84)
Resolves #81.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-09-16 00:46:21 +08:00
Tao He efcecb7731 Add a "head" method on the client the retrieve the latest revision.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-06-16 17:10:32 +08:00
Tao He 1b24751b9d
List/delete/watch on exact range. (#51)
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-01 14:50:50 +08:00
Tao He 6962030db8 Implements "KeepAlive" feature, and enhance "lock" with a lease.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-01-10 23:39:50 +08:00
Tao He eb284103e0 Auto and watch functionalities on SyncClient.
Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
2020-10-10 20:17:32 +08:00
arches 888946b589 Added new interface for leasegrant and leaseId in add, set, modify, modify_if 2016-07-13 07:56:43 -04:00
arches ac54e84f6d Use ttl 2016-07-13 07:20:15 -04:00
arches 174ea401b8 Added SyncClient class 2016-07-04 06:54:07 -04:00