# Etcd client

**URL:** <https://forums.swift.org/t/etcd-client/70406>\
**Category:** GSoC\
**Tags:** concurrency, grpc, gsoc-2024\
**Created:** [March 2, 2024, 11:03pm UTC](https://forums.swift.org/t/etcd-client/70406 "2024-03-02T23:03:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayushi2103](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ayushi2103/32/34272_2.png) [@ayushi2103](https://forums.swift.org/u/ayushi2103)\
**Post date:** [March 2, 2024, 11:03pm UTC](https://forums.swift.org/t/etcd-client/70406/1 "2024-03-02T23:03:44Z")

</div>

Hello Swift Community,

I am Ayushi, I recently graduated from University of Waterloo in Computer Engineering and I am planning to pursue my Masters in Computer Engineering in September. I have experience in Swift and distributed systems through my past internships and academic courses.

I was looking into the project of a native client for interacting with etcd servers using gRPC APIs. The client aims to integrate etcd into their Swift applications seamlessly, leveraging Swift's concurrency and async/await.

The Swift-etcd client will tackle these areas:

1. Authentication: Support variety of authentication mechanisms e.g. TLS certificates and auth tokens. Targeting v3 auth in etcd-client, and supporting TTL for v3 auth.

2. K,V Operations: The etcd-client should support get, put, delete, operations.

3. Watch operations: The etcd-client will monitor for changes on a specific key / range of keys, and update the user when the watch operation is complete.

4. Lease operations: The client will support lease operations with a default / specified TTL, and will allow users to revoke and keep-alive the existing lease operation.

The etcd-client supports many more operations, and these are a small subset of those operations. Are there more operations that would need to be added for the swift-etcd-client to make it production ready? Are there any considerations I have not taken into account?

@FranzBusch Looking forward to connect and all the Swift community!

Thank you,

Ayushi Tiwari

---

<div class="post-metadata">

**Author:** ![FranzBusch](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/franzbusch/32/19447_2.png) [@FranzBusch](https://forums.swift.org/u/FranzBusch)\
**Post date:** [March 5, 2024, 10:53am UTC](https://forums.swift.org/t/etcd-client/70406/2 "2024-03-05T10:53:02Z")

</div>

Hey @ayushi2103,

Thanks for voicing interest in the project. Let me try to answer some of the questions that you have:

> [@ayushi2103](#):
>
> Q1: What sort of auth tokens should it support? According to [etcd docs](https://etcd.io/docs/v3.4/learning/design-auth-v3/), simple and JWT tokens can be used, with JWT designed for production use cases.

You are right that etcd uses two different kinds of token but this fact should be mostly irrelevant for a client since clients should treat the token as an opaque string and just send it with every gRPC call.

> [@ayushi2103](#):
>
> - Q2: If there are multiple tokens (simple, JWT), would multiple environments need to be supported? E.g. dev/prod environments.
> - Q3: Should an external host be supported, e.g. [api.example.com](http://api.example.com)?

None of this applies to the client. The client should take a configuration that either enables or disables authentication. If authentication is enabled then it should also take a `username: String` and `password: String`.

> [@ayushi2103](#):
>
> Q1: Should flags be supported, e.g. get --from-key foo?

> [@ayushi2103](#):
>
> Should multiple operations be supported in a delete? E.g. del foo1 foo2?

etcd talks in key ranges and bot the `RangeRequest` and the `DeleteRangeRequest` take a `key` and `range_end`. We should expose this in our Swift client's APIs. Users can then query or delete multiple keys.

> [@ayushi2103](#):
>
> Q3: Should historical changes of keys be considered to support revisions? E.g. etcdctl put foo bar; etcdctl put foo bar2

I don't think that is something that our Swift API needs to consider.

> [@ayushi2103](#):
>
> Q1: Should the progress command be supported to return watch progress?

We should make this a stretch goal of the project. The progress command is used to periodically receive responses with no events to allow clients to detect if a watcher has been disconnected.

> [@ayushi2103](#):
>
> The etcd-client supports many more operations, and these are a small subset of those operations. Are there more operations that would need to be added for the swift-etcd-client to make it production ready? Are there any considerations I have not taken into account?

For now the project is just focused on providing support for the listed operations. However, if we have more time we can look into supporting all of the `Auth`, `Cluster` and `Maintenance` APIs.

Let me know if this answers your questions!

Franz

---

<div class="post-metadata">

**Author:** ![ayushi2103](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ayushi2103/32/34272_2.png) [@ayushi2103](https://forums.swift.org/u/ayushi2103)\
**Post date:** [March 5, 2024, 11:46am UTC](https://forums.swift.org/t/etcd-client/70406/3 "2024-03-05T11:46:22Z")

</div>

Thank you for providing clarity on several aspects of the project. Your responses address most of the concerns and questions. I will start drafting my proposal now, are there any specifics swift is looking for in the proposal? Also, is it possible to share the draft with you once its done so I can get some feedback?  
Thanks again for all the answers.

---

<div class="post-metadata">

**Author:** ![FranzBusch](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/franzbusch/32/19447_2.png) [@FranzBusch](https://forums.swift.org/u/FranzBusch)\
**Post date:** [March 5, 2024, 1:02pm UTC](https://forums.swift.org/t/etcd-client/70406/4 "2024-03-05T13:02:00Z")

</div>

> [@ayushi2103](#):
>
> Also, is it possible to share the draft with you once its done so I can get some feedback?

Of course! Feel free to send me the draft in a DM here on the forums once it is ready!

---

<div class="post-metadata">

**Author:** ![ayushi2103](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ayushi2103/32/34272_2.png) [@ayushi2103](https://forums.swift.org/u/ayushi2103)\
**Post date:** [March 5, 2024, 1:03pm UTC](https://forums.swift.org/t/etcd-client/70406/5 "2024-03-05T13:03:17Z")

</div>

Okay! Thanks a lot!

---

<div class="post-metadata">

**Author:** ![ayushi2103](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ayushi2103/32/34272_2.png) [@ayushi2103](https://forums.swift.org/u/ayushi2103)\
**Post date:** [March 12, 2024, 12:44pm UTC](https://forums.swift.org/t/etcd-client/70406/6 "2024-03-12T12:44:21Z")

</div>

Hi @FranzBusch,  
I have messaged you a draft, please have look at your convenience.

Thanks,  
Ayushi

---

<div class="post-metadata">

**Author:** ![ktoso](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ktoso/32/44526_2.png) [@ktoso](https://forums.swift.org/u/ktoso)\
**Post date:** [March 12, 2024, 12:45pm UTC](https://forums.swift.org/t/etcd-client/70406/7 "2024-03-12T12:45:42Z")

</div>

@ayushi2103, just in case Franz would not respond before the submission deadlines - as I know is traveling right now - feel free to add myself as well and I can provide hints.

And make sure to not miss the actual submission :)

---

<div class="post-metadata">

**Author:** ![ayushi2103](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ayushi2103/32/34272_2.png) [@ayushi2103](https://forums.swift.org/u/ayushi2103)\
**Post date:** [March 12, 2024, 12:46pm UTC](https://forums.swift.org/t/etcd-client/70406/8 "2024-03-12T12:46:48Z")

</div>

Ohh sure, I have added you in the chat, thanks a lot!
