1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add note on EndpointInfo semantics

The comments in the code don't explain enough, and this is arguably a
better place for such an explanation.
This commit is contained in:
Michael Bridgen 2015-06-05 13:39:37 +01:00
parent 3e160cb896
commit 991f50a10c

View file

@ -113,10 +113,20 @@ Drivers are essentially an extension of libnetwork and provides the actual imple
* `driver.Join`
* `driver.Leave`
These Driver facing APIs makes use of unique identifiers (`networkid`,`endpointid`,...) instead of names (as seen in user-facing APIs).
These Driver facing APIs makes use of unique identifiers (`networkid`,`endpointid`,...) instead of names (as seen in user-facing APIs).
The APIs are still work in progress and there can be changes to these based on the driver requirements especially when it comes to Multi-host networking.
### Driver semantics
* `Driver.CreateEndpoint`
This method is passed an interface `EndpointInfo`, with methods `Interfaces` and `AddInterface`.
If the slice returned by `Interfaces` is non-empty, the driver is expected to make use of the interface infomation therein (e.g., treating the address or addresses as statically supplied), and must return an error if it cannot. If the slice is empty, the driver should allocate zero or more _fresh_ interfaces, and use `AddInterface` to record them; or return an error if it cannot.
It is forbidden to use `AddInterface` if `Interfaces` is non-empty.
## Implementations
Libnetwork includes the following driver packages: