store.go 966 B

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