mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-09-04 21:01:42 +00:00
Replacing isReservedNetwork with Driver capability
Currently store makes use of a static isReservedNetwork check to decide if a network needs to be stored in the distributed store or not. But it is better if the check is not static, but be determined based on the capability of the driver that backs the network. Hence introducing a new capability mechanism to the driver which it can express its capability during registration. Making use of first such capability : Scope. This can be expanded in the future for more such cases. Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
+16
-1
@@ -118,5 +118,20 @@ type JoinInfo interface {
|
||||
// DriverCallback provides a Callback interface for Drivers into LibNetwork
|
||||
type DriverCallback interface {
|
||||
// RegisterDriver provides a way for Remote drivers to dynamically register new NetworkType and associate with a driver instance
|
||||
RegisterDriver(name string, driver Driver) error
|
||||
RegisterDriver(name string, driver Driver, capability Capability) error
|
||||
}
|
||||
|
||||
// Scope indicates the drivers scope capability
|
||||
type Scope int
|
||||
|
||||
const (
|
||||
// LocalScope represents the driver capable of providing networking services for containers in a single host
|
||||
LocalScope Scope = iota
|
||||
// GlobalScope represents the driver capable of providing networking services for containers across hosts
|
||||
GlobalScope
|
||||
)
|
||||
|
||||
// Capability represents the high level capabilities of the drivers which libnetwork can make use of
|
||||
type Capability struct {
|
||||
Scope Scope
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user