database

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2019 License: GPL-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

type MySQL struct {
	// contains filtered or unexported fields
}

func NewMySQL

func NewMySQL() (*MySQL, error)

func (*MySQL) DHCP

func (r *MySQL) DHCP(mac net.HardwareAddr) (conf *dhcp.NetConfig, err error)

func (*MySQL) Elect

func (r *MySQL) Elect(uid string, expiration time.Duration) (elected bool, err error)

Elect selects a new master as uid if there is a no existing master that has been updated within expiration. elected will be true if this uid has been elected as the new master or was already elected.

func (*MySQL) Exec

func (r *MySQL) Exec(f func(ui.Transaction) error) error

Exec executes all queries of f in a single transaction. f should return the error raised from the ui.Transaction without any change or wrapping it for deadlock protection.

func (*MySQL) GetARPTable

func (r *MySQL) GetARPTable() (result []announcer.ARPTableEntry, err error)

func (*MySQL) GetUndiscoveredHosts

func (r *MySQL) GetUndiscoveredHosts(expiration time.Duration) (result []net.IPNet, err error)

GetUndiscoveredHosts returns IP addresses whose physical location is still undiscovered or staled more than expiration. result can be nil on empty result.

func (*MySQL) Location

func (r *MySQL) Location(mac net.HardwareAddr) (dpid string, port uint32, status network.LocationStatus, err error)

func (*MySQL) MAC

func (r *MySQL) MAC(ip net.IP) (mac net.HardwareAddr, ok bool, err error)

func (*MySQL) MACAddrs

func (r *MySQL) MACAddrs() (result []net.HardwareAddr, err error)

MACAddrs returns all the registered MAC addresses.

func (*MySQL) RenewARPTable

func (r *MySQL) RenewARPTable() error

func (*MySQL) ResetHostLocationsByDevice

func (r *MySQL) ResetHostLocationsByDevice(swDPID uint64) error

ResetHostLocationsByDevice sets NULL to the host locations that belong to the device specified by swDPID.

func (*MySQL) ResetHostLocationsByPort

func (r *MySQL) ResetHostLocationsByPort(swDPID uint64, portNum uint16) error

ResetHostLocationsByPort sets NULL to the host locations that belong to the port specified by swDPID and portNum.

func (*MySQL) ToggleDeviceVIP

func (r *MySQL) ToggleDeviceVIP(swDPID uint64) (result []virtualip.Address, err error)

func (*MySQL) TogglePortVIP

func (r *MySQL) TogglePortVIP(swDPID uint64, portNum uint16) (result []virtualip.Address, err error)

func (*MySQL) UpdateHostLocation

func (r *MySQL) UpdateHostLocation(mac net.HardwareAddr, ip net.IP, swDPID uint64, portNum uint16) (updated bool, err error)

UpdateHostLocation updates the physical location of a host, whose MAC and IP addresses are matched with mac and ip, to the port identified by swDPID and portNum. updated will be true if its location has been actually updated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL