use an in memory store for containers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
7fc874e05e
commit
35ef46f805
5 changed files with 173 additions and 38 deletions
28
oci/store.go
Normal file
28
oci/store.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package oci
|
||||
|
||||
// StoreFilter defines a function to filter
|
||||
// container in the store.
|
||||
type StoreFilter func(*Container) bool
|
||||
|
||||
// StoreReducer defines a function to
|
||||
// manipulate containers in the store
|
||||
type StoreReducer func(*Container)
|
||||
|
||||
// Store defines an interface that
|
||||
// any container store must implement.
|
||||
type Store interface {
|
||||
// Add appends a new container to the store.
|
||||
Add(string, *Container)
|
||||
// Get returns a container from the store by the identifier it was stored with.
|
||||
Get(string) *Container
|
||||
// Delete removes a container from the store by the identifier it was stored with.
|
||||
Delete(string)
|
||||
// List returns a list of containers from the store.
|
||||
List() []*Container
|
||||
// Size returns the number of containers in the store.
|
||||
Size() int
|
||||
// First returns the first container found in the store by a given filter.
|
||||
First(StoreFilter) *Container
|
||||
// ApplyAll calls the reducer function with every container in the store.
|
||||
ApplyAll(StoreReducer)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue