Commit Graph

254 Commits

Author SHA1 Message Date
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
Tao He 6a0b6696e5 Fixes the hardcode language standard in CMakeLists.txt.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-12-22 10:16:38 +08:00
Tao He 8678cec1f7 Bump up version to v0.2.2.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-11-14 21:23:41 +08:00
Tao He 0d672ffa1c
Accept an `grpc::ChannelArguments` argument in client's constructors. (#104)
* Accept an `grpc::ChannelArguments` argument in client's constructors.

   Resolves #103.

* Backwards compatibility with Ubuntu 18.04.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-11-09 00:31:59 +08:00
Matthew Fioravante bfb56be151
Expose key version in etcd::Value (#97) 2021-10-27 12:49:34 +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
Matthew Fioravante e9db91b335
Allow changing Transaction key (#93)
* Allow changing Transaction key
* Fixes the compilation errors.

Signed-off-by: Matthew Fioravante <fmatthew5876@gmail.com>
Co-authored-by: Tao He <sighingnow@gmail.com>
2021-10-08 11:12:35 +08:00
Tao He b99dc2024e
Include compact revision for cancelled watch response. (#91)
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-09-28 11:24:11 +08:00
Tao He a949dec288
Add an optional `target_name_override` to support multiple-endpoints with SSL. (#89)
Resolves #87.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-09-24 02:41:46 +08:00
Tao He 6eed82a766
Fixes memory leak in shutting down gRPC streams. (#88)
* Fixes memory leak in shutting down gRPC streams.

Resolve #86.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-09-23 14:51:29 +08:00
mszy d386bb96b0
Removing memory-leak, fixes #83. (#85)
Co-authored-by: morgan.szygenda <morgan.szygenda@scle.fr>
2021-09-22 10:50:33 +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 116b49b784
Lint source code, improve the quality and readability. (#82)
* Lint the source first, prepare for implementing #81.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-09-15 14:59:55 +08:00
Tao He 42c2fdf58c Ugrade vcpkg sources.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-08-24 00:13:10 +08:00
Tao He 1b68f9c79d Fixes for #80 and #79, should set `CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS` instead.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-08-24 00:10:11 +08:00
Tao He 0e4934523e
MSVC: export all global symbols by default. (#80)
Resolves #79.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-08-23 23:33:29 +08:00
Tao He a69638409c The target protobuf::protoc exists since cmake 3.10.
Fixes for cmake version later than v3.10, e.g., cmake 3.9.

See also upstream patch:

    c281acf807

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-08-04 11:27:56 +08:00
Tao He 891dc7bedf Revisit docs about how could we "reconnect" when failure.
See also:

   https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/issues/73#issuecomment-888150328


Signed-off-by: Tao He <sighingnow@gmail.com>
2021-07-28 17:57:33 +08:00
Tao He 3d4fa143e0 Set `etcd-cpp-api_FOUND`, fixes #77.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-07-16 00:56:49 +08:00
Yue 2338a83fd5
Add a brief doc and sample code describing how a watcher can re-connect to etcd server after disconnected. (#76) 2021-07-15 23:55:01 +08:00
Tao He 7559258b87 Update vcpkg configs, fixes #72.
Resolves microsoft/vcpkg#18901 as well.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-07-13 00:53:05 +08:00
Tao He 0dc89e4c1e Add openssl/libssl-dev to requirements.
Resolves #71.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-07-01 18:00:26 +08:00
Yue 6704b9373f
Minor update for vcpkg portfile so that the port can be installed on macOS. And update the portfile to use the latest release v0.2.1. (#69) 2021-06-20 16:10:08 +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 68c5626d2c Keepalive: join the thread outside the background job itself.
Fixes #67, when etcd server stops, the keepalive action will crash.


Signed-off-by: Tao He <sighingnow@gmail.com>
2021-06-15 12:03:35 +08:00
Tao He b3a193c75e Fixes several typos in REAEMD.
Fixes #63.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-06-01 17:27:20 +08:00
Tao He 230ebfd08b
Avoid duplicate const string tags. (#62)
On behalf of Asplund, Rickard, thanks!

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-28 23:22:32 +08:00
Tao He 46f36dac6d Fixes a typo in example code in README.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-28 14:34:08 +08:00
Tao He 9d794504aa Drop unused log message.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-28 10:09:41 +08:00
Tao He 4dda2db5a1 Compatible with older version of gRPC.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-27 23:13:04 +08:00
Tao He e80709418b Avoid including protobuf & grpc headers in our interface files.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-27 22:10:24 +08:00
Tao He 0b9a4f36ce Upgrade catch.hpp to v2.13.6.
As we have noticed a random "Segmentation fault" error with the following backtrace:

(gdb) bt
#0  _int_free (av=0x7f3db4000020, p=0x7f3db40018a0, have_lock=0) at malloc.c:4199
#1  0x0000557164b22982 in Catch::AssertionInfo::~AssertionInfo (this=0x7f3c32fcc3c8, __in_chrg=<optimized out>) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:827
#2  0x0000557164b0afd6 in Catch::AssertionResult::~AssertionResult (this=0x7f3c32fcc3c8, __in_chrg=<optimized out>) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:7275
#3  0x0000557164b117f4 in Catch::AssertionStats::~AssertionStats (this=0x7f3c32fcc3c0, __in_chrg=<optimized out>) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:10254
#4  0x0000557164b26d8c in Catch::RunContext::assertionEnded (this=0x7ffc893f2e40, result=...) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:5981
#5  0x0000557164b0f77f in Catch::ResultBuilder::handleResult (this=0x7f3c32fcca00, result=...) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:8271
#6  0x0000557164b0f6ee in Catch::ResultBuilder::captureExpression (this=0x7f3c32fcca00) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:8267
#7  0x0000557164b0f2ca in Catch::ResultBuilder::endExpression (this=0x7f3c32fcca00) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:8229
#8  0x0000557164b4637c in Catch::ExpressionLhs<bool>::endExpression (this=0x7f3c32fcc6f0) at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/catch.hpp:1850
#9  0x0000557164b176de in <lambda(const string&, size_t)>::operator()(const std::string &, size_t) const (__closure=0x557164dcb6b0, key="/test/test_key", index=112)
    at /home/gsbot/hetao/libvineyard/thirdparty/etcd-cpp-apiv3/tst/LockTest.cpp:184

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-25 13:31:11 +08:00
Tao He eab29edaf0 Fixes unused warnings.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-25 13:29:36 +08:00
Tao He e45862b281 Upgrade v0.2.1 after a set of bugfixes.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-24 14:58:05 +08:00
Tao He 9e77fdb2ee
Fixes lock, and the underlying keepalive implmentation. (#60)
* Fixes lock, and the underlying keepalive implmentation.

The previous implementation is buggy when a lot of locks happen at the same time,
as the cpprestsdk's threadpool use a fixed number of thread for posix platform:

https://github.com/microsoft/cpprestsdk/blob/master/Release/src/pplx/threadpool.cpp#L198

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-05-21 18:05:35 +08:00
Tao He bb22ef4d7f Revert "Wait: wait without callback, otherwise there will be use-after-dtor."
This reverts commit 7b16ce6770.

That patch is invalid.
2021-04-28 17:36:27 +08:00
Tao He 7b16ce6770 Wait: wait without callback, otherwise there will be use-after-dtor.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-27 22:24:04 +08:00
Tao He b3ce183889
Expose the etcdv3::detail::string_plus_one method. (#56)
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-08 10:33:39 +08:00
Nils Carlson ad2da0ac7e
Change KeepAlive lease expiry to throw std::out_of_range (#55)
Update documentation to show different exceptions used by KeepAlive as well.
2021-04-08 10:18:26 +08:00
Tao He 3e30c4c61d
Optimize the implementation of error handling in keep alive. (#54)
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-07 23:20:33 +08:00
Tao He cee938fb0a Use UTF-8 char U+0000 as terminate charactor.
Allow setting range end as `NULL`, see also #50.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-07 15:08:51 +08:00
Tao He 52d757f14a Make the watcher test more stable on CI.
Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-07 09:39:15 +08:00
Tao He 62a846d798
Handling (or checking) possible failure in lease's KeepAlive. (#53)
* Handling (or checking) possible failure in lease's KeepAlive.
* Add documentation.
* Enhance documentations.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-02 17:15:27 +08:00
Tao He 27e6e2ac11
Watch on range by specifying `rang_end`. (#52)
Follow-up work on #51, and fixes #50.

Signed-off-by: Tao He <sighingnow@gmail.com>
2021-04-02 01:34:58 +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 1f9f80b5ff Fixes CPACK_DEBIAN_PACKAGE_INSTALL. 2021-03-30 21:12:32 +08:00
Tao He 402651630f Add debhelper to build depens 2021-03-30 18:56:34 +08:00
Tao He 1e332eafbc Fixes the build deps and specify the build number. 2021-03-30 18:25:42 +08:00
Tao He fe5bbb6081 Implements deb packaging and put to ppa. 2021-03-30 18:14:35 +08:00