container

package
v0.0.0-...-9c99d76 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2014 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIST_SELF = iota
	LIST_RECURSIVE
)

Listing types.

Variables

This section is empty.

Functions

func ClearContainerHandlerFactories

func ClearContainerHandlerFactories()

Clear the known factories.

func RegisterContainerHandlerFactory

func RegisterContainerHandlerFactory(factory ContainerHandlerFactory)

Register a ContainerHandlerFactory. These should be registered from least general to most general as they will be asked in order whether they can handle a particular container.

Types

type ContainerHandler

type ContainerHandler interface {
	ContainerReference() (info.ContainerReference, error)
	GetSpec() (*info.ContainerSpec, error)
	GetStats() (*info.ContainerStats, error)
	ListContainers(listType ListType) ([]info.ContainerReference, error)
	ListThreads(listType ListType) ([]int, error)
	ListProcesses(listType ListType) ([]int, error)
}

Interface for container operation handlers.

func NewBlackListFilter

func NewBlackListFilter(handler ContainerHandler, forbiddenPaths ...string) ContainerHandler

func NewContainerHandler

func NewContainerHandler(name string) (ContainerHandler, error)

Create a new ContainerHandler for the specified container.

func NewWhiteListFilter

func NewWhiteListFilter(handler ContainerHandler, acceptedPaths ...string) ContainerHandler

type ContainerHandlerFactory

type ContainerHandlerFactory interface {
	// Create a new ContainerHandler using this factory. CanHandle() must have returned true.
	NewContainerHandler(name string) (ContainerHandler, error)

	// Returns whether this factory can handle the specified container.
	CanHandle(name string) bool

	// Name of the factory.
	String() string
}

type FactoryForMockContainerHandler

type FactoryForMockContainerHandler struct {
	Name                        string
	PrepareContainerHandlerFunc func(name string, handler *MockContainerHandler)
}

func (*FactoryForMockContainerHandler) CanHandle

func (self *FactoryForMockContainerHandler) CanHandle(name string) bool

func (*FactoryForMockContainerHandler) NewContainerHandler

func (self *FactoryForMockContainerHandler) NewContainerHandler(name string) (ContainerHandler, error)

func (*FactoryForMockContainerHandler) String

func (self *FactoryForMockContainerHandler) String() string

type ListType

type ListType int

type MockContainerHandler

type MockContainerHandler struct {
	mock.Mock
	Name    string
	Aliases []string
}

This struct mocks a container handler.

func (*MockContainerHandler) ContainerReference

func (self *MockContainerHandler) ContainerReference() (info.ContainerReference, error)

If self.Name is not empty, then ContainerReference() will return self.Name and self.Aliases. Otherwise, it will use the value provided by .On().Return().

func (*MockContainerHandler) GetSpec

func (self *MockContainerHandler) GetSpec() (*info.ContainerSpec, error)

func (*MockContainerHandler) GetStats

func (self *MockContainerHandler) GetStats() (*info.ContainerStats, error)

func (*MockContainerHandler) ListContainers

func (self *MockContainerHandler) ListContainers(listType ListType) ([]info.ContainerReference, error)

func (*MockContainerHandler) ListProcesses

func (self *MockContainerHandler) ListProcesses(listType ListType) ([]int, error)

func (*MockContainerHandler) ListThreads

func (self *MockContainerHandler) ListThreads(listType ListType) ([]int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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