github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/container/store.go (about)

     1  package container // import "github.com/demonoid81/moby/container"
     2  
     3  // StoreFilter defines a function to filter
     4  // container in the store.
     5  type StoreFilter func(*Container) bool
     6  
     7  // StoreReducer defines a function to
     8  // manipulate containers in the store
     9  type StoreReducer func(*Container)
    10  
    11  // Store defines an interface that
    12  // any container store must implement.
    13  type Store interface {
    14  	// Add appends a new container to the store.
    15  	Add(string, *Container)
    16  	// Get returns a container from the store by the identifier it was stored with.
    17  	Get(string) *Container
    18  	// Delete removes a container from the store by the identifier it was stored with.
    19  	Delete(string)
    20  	// List returns a list of containers from the store.
    21  	List() []*Container
    22  	// Size returns the number of containers in the store.
    23  	Size() int
    24  	// First returns the first container found in the store by a given filter.
    25  	First(StoreFilter) *Container
    26  	// ApplyAll calls the reducer function with every container in the store.
    27  	ApplyAll(StoreReducer)
    28  }