Commit Graph

174 Commits

Author SHA1 Message Date
qiupengfei 247b50b5d4 Fix: keepalive exit without any message due to clock drift 2023-12-11 09:43:27 +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 0eee75b52e
KeepAlive: auto grant a new lease if 0 is given as lease id (#242)
Fixes #3037

Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
2023-07-20 14:21:27 +08:00
Tao He 3d344190d7
Fixes txn delete response to keep backwards compatibility (#239)
Signed-off-by: Tao He <linzhu.ht@alibaba-inc.com>
2023-07-17 10:43:19 +08:00
Tao He 068f37ba5c
Fixes the watcher cannot be cancelled issue with etcd 3.x (#238)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-07-15 20:00:16 +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 204038c4bc Fixes format issues
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-07-01 21:03:20 +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 fe9f17e61e
Fixes a possible bug about watcher's id (#232)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-07-01 18:41:33 +08:00
Tao He 32fae70113
Fixes the implementation of Observe() (#231)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-07-01 13:30:43 +08:00
Tao He a8d5980c76
Include watch_id in the response (#223)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-05-16 09:45:51 +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 c72e072f77
Add an option `BUILD_ETCD_CORE_ONLY=ON/OFF` to select the runtime (#208)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-19 11:31:57 +08:00
Tao He 9fc0f37ef7
Fixes a bug in lease action when grpc timeout is set (#204)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-14 20:37:34 +08:00
Tao He 5e27ac33c6
Fixes the segmentation fault error in watcher (#206)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-14 20:36:53 +08:00
Tao He f0f9c4e8c2
Enhance the campaign test and document the behaviour when timeout is set (#205)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-14 19:43:37 +08:00
Tao He cad42fdf07
Fixes the wrong key setup in watcher (#201)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-10 15:05:28 +08:00
Tao He 9d3f8cec3d
Fixes bugs in ls/rmdir/watch for processing range end. (#199)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-07 21:47:10 +08:00
Tao He b12fc293b9
Fixes memory leak issue inside the watcher (#197)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-05 23:08:10 +08:00
Tao He 80b4d2178f Don't refer this pointer inside the detached thread
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-03-05 01:35:21 +08:00
Tao He 817153bcc9
Improve the cmake script for better compatibility (#195)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-02-19 11:14:05 +08:00
Tao He 3133fbec21
Fixes the Check() error when if next refresh is not triggered yet (#193)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-02-15 17:14:48 +08:00
Tao He 9b5c5bd3c6
Fixes the deadlock in keep alive (#191)
Signed-off-by: Tao He <sighingnow@gmail.com>
2023-02-14 21:20:12 +08:00
Rui Chen 5c7e155c9e
Add an cmake option which respect `CMAKE_CXX_STANDARD` for cxx standard. (#188) 2023-02-01 11:51:38 +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 2f15c45d4e
Protect the timer to avoid "cancel" and "refresh" happens at the same time. (#179)
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-10-24 10:29:38 +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 c81f3fb211
Watcher: add constructors to accept the wait callback. (#169)
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-09-29 15:18:15 +08:00
Tao He 39be27e021
Add a sync variant of lock on async client. (#163)
Resolves #139.

Lock is special, as it may cause the thread resources (in the pplx
thread pool) to be exhausted.

Signed-off-by: Tao He <sighingnow@gmail.com>
2022-09-20 21:20:58 +08:00
Tao He ed7ab08ef7 Limit C++ flags to this library itself.
Resolves #159.

Signed-off-by: Tao He <sighingnow@gmail.com>
2022-09-20 20:11:10 +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 7c9b9e5699 Enable grpc timeout support in keepalive's refresh.
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-05-24 00:20:55 +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 9a5267286b Use a explicit copy constructor as we noticed stack-buffer-overflow inside the copy ctor when ASAN is enabled
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-04-24 10:30:10 +08:00
Tao He bd4ec37ff4 Use int64_t for etcd revisions/indexes.
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-04-21 18:52:34 +08:00
Tao He 680e8ad5c6 Replace Tabs in sources and README with spaces.
Signed-off-by: Tao He <sighingnow@gmail.com>
2022-04-08 20:49:56 +08:00
Tao He 56c7189f92 Revisit the watcher's reconnect functionality.
Address #73, #76, #117 and #118.

Signed-off-by: Tao He <sighingnow@gmail.com>
2022-04-08 19:55:31 +08:00
Tao He f70255c8b0 Revert "Add support to re-activate watcher from wait_callback in watcher async wait."
This reverts commit 0467c0eef3.
2022-04-08 19:55:31 +08:00
Tao He d4975f84b3
Return complete meta information of HEAD. (#123)
* Return complete meta information of HEAD.
* Fixes the CI by revisiting the LD_LIBRARY_PATH.

Signed-off-by: Tao He <sighingnow@gmail.com>
2022-04-06 16:01:49 +08:00
David Pastor 0467c0eef3 Add support to re-activate watcher from wait_callback in watcher async wait.
Returns wait result when cancelling watcher.
2022-03-29 19:39:04 +08:00