package disk

import "github.com/containernetworking/cni/plugins/ipam/host-local/backend/disk"

Index

Types

type FileLock

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

FileLock wraps os.File to be used as a lock using flock

func NewFileLock

func NewFileLock(path string) (*FileLock, error)

NewFileLock opens file/dir at path and returns unlocked FileLock object

func (*FileLock) Close

func (l *FileLock) Close() error

Close closes underlying file

func (*FileLock) Lock

func (l *FileLock) Lock() error

Lock acquires an exclusive lock

func (*FileLock) Unlock

func (l *FileLock) Unlock() error

Unlock releases the lock

type Store

type Store struct {
	FileLock
	// contains filtered or unexported fields
}

func New

func New(network string) (*Store, error)

func (*Store) Release

func (s *Store) Release(ip net.IP) error

func (*Store) ReleaseByID

func (s *Store) ReleaseByID(id string) error

N.B. This function eats errors to be tolerant and release as much as possible

func (*Store) Reserve

func (s *Store) Reserve(id string, ip net.IP) (bool, error)

Source Files

backend.go lock.go

Version
v0.1.0
Published
Jul 22, 2015
Platform
linux/amd64
Imports
5 packages
Last checked
1 day ago

Tools for package owners.