Skip to content

Commit acb7fda

Browse files
authored
Update README.md
1 parent 0af4a1e commit acb7fda

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ conn = Etcdv3.new(endpoints: 'https://hostname:port')
2626
# Secure connection with Auth
2727
conn = Etcdv3.new(endpoints: 'https://hostname:port', user: 'root', password: 'mysecretpassword')
2828

29+
# Scope CRUD operations to a specific keyspace.
30+
conn = Etcdv3.new(endpoints: 'https://hostname:port', namespace: "/target_keyspace/")
31+
2932
# Secure connection specifying custom certificates
3033
# Coming soon...
3134

@@ -48,6 +51,24 @@ need to take care of `GRPC::Unauthenticated` exception and manually re-authentic
4851
when token expires. To reiterate, you are responsible for handling the errors, so
4952
some understanding of how this gem and etcd works is recommended.
5053

54+
## Namespace support
55+
56+
Namespacing is a convenience feature used to scope CRUD based operations to a specific keyspace.
57+
58+
```ruby
59+
# Establish connection
60+
conn = Etcdv3.new(endpoints: 'https://hostname:port', namespace: '/service-a/')
61+
62+
# Write key to /service-a/test_key
63+
conn.put("test_key", "value").
64+
65+
# Get the key we just wrote.
66+
conn.get("test_key")
67+
```
68+
69+
_Note: Namespaces are stripped from responses._
70+
71+
5172
## Adding, Fetching and Deleting Keys
5273
```ruby
5374
# Put

0 commit comments

Comments
 (0)