Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit cc57776

Browse files
committed
A little bit of README Driven Development
1 parent 53e2035 commit cc57776

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Table of Contents
1212
* [Functions](#functions)
1313
* [get_upstreams](#get_upstreams)
1414
* [get_servers](#get_servers)
15+
* [add_server_to_upstream](#add_server_to_upstream)
16+
* [remove_server_from_upstream](#remove_server_from_upstream)
1517
* [get_primary_peers](#get_primary_peers)
1618
* [get_backup_peers](#get_backup_peers)
1719
* [set_peer_down](#set_peer_down)
@@ -126,6 +128,34 @@ The return value is an array-like Lua table. Each table entry is a hash-like Lua
126128

127129
[Back to TOC](#table-of-contents)
128130

131+
add_server_to_upstream
132+
-----------
133+
`syntax: err = upstream.add_server_to_upstream(upstream_name, server)`
134+
135+
Add a server to a given upstream. The server should be a hash-like Lua table and may contain the following keys (bolded keys are required):
136+
137+
* **name**
138+
* **addr**
139+
socket address(es). can be either a Lua string or an array-like Lua table of Lua strings.
140+
* backup
141+
* fail_timeout
142+
* max_fails
143+
* weight
144+
145+
The return value is an error string or nil.
146+
147+
[Back to TOC](#table-of-contents)
148+
149+
remove_server_from_upstream
150+
-----------
151+
`syntax: err = upstream.remove_server_from_upstream(upstream_name, server_name)`
152+
153+
Removes a server from an upstream given the upstream and server names. The server name is expected to match the `name` field on the server in the upstream.
154+
155+
The return value is an error string or nil.
156+
157+
[Back to TOC](#table-of-contents)
158+
129159
get_primary_peers
130160
---------
131161
`syntax: peers = upstream.get_primary_peers(upstream_name)`
@@ -329,4 +359,3 @@ See Also
329359
* the [lua-resty-upstream-healthcheck](https://github.com/openresty/lua-resty-upstream-healthcheck) library which makes use of the Lua API provided by this module.
330360

331361
[Back to TOC](#table-of-contents)
332-

0 commit comments

Comments
 (0)