From d6db97f276ecb41468dfbbe5d0260e18da86d34f Mon Sep 17 00:00:00 2001 From: Michael Bridgen Date: Fri, 5 Jun 2015 13:39:37 +0100 Subject: [PATCH] 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. --- docs/design.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/design.md b/docs/design.md index 2802a6e..ee9cb53 100644 --- a/docs/design.md +++ b/docs/design.md @@ -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: