Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrReservationAlreadyExist is returned when reservation for id and interface already exist in the pool ErrReservationAlreadyExist = errors.New("reservation already exist, " + "duplicate allocations are not allowed by the spec") // ErrIPAlreadyReserved is returned when trying to reserve IP which is already reserved ErrIPAlreadyReserved = errors.New("ip address is already reserved") )
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session interface { // Reserve reserves IP for the id and interface name, // returns error if allocation failed Reserve(pool string, id string, ifName string, meta types.ReservationMetadata, address net.IP) error // ListReservations list all reservations in the pool ListReservations(pool string) []types.Reservation // ListPools return list with names of all known pools ListPools() []string // RemovePool removes information about the pool from the store RemovePool(pool string) // GetLastReservedIP returns last reserved IP for the pool or nil GetLastReservedIP(pool string) net.IP // SetLastReservedIP set last reserved IP fot the pool SetLastReservedIP(pool string, ip net.IP) // ReleaseReservationByID releases reservation by id and interface name ReleaseReservationByID(pool string, id string, ifName string) // GetReservationByID returns existing reservation for id and interface name, // return nil if allocation not found GetReservationByID(pool string, id string, ifName string) *types.Reservation // Commit writes persistedData to the disk and release the lock. // the store can't be used after this call Commit() error // Cancel cancels all modifications and release the lock // the store can't be used after this call Cancel() }
Session is the interface implemented by the store package
type Store ¶
type Store interface { // Open returns a session for the store with exclusive lock. // returns an error if failed to read persistedData from the disk. // Open blocks if another Session is already opened. // Session.Commit() should be called to close the session, release the lock and write changes to disk and // Session.Cancel() can be called to close the session, revert all changes and release the lock Open(ctx context.Context) (Session, error) }
Store implements API to open file store in exclusive mode
Click to show internal directories.
Click to hide internal directories.