src.dualinventive.com/go/devsim/repository/repository.go

44 lines
1.3 KiB
Go

package repository
import "src.dualinventive.com/go/devsim/simulator"
// Bucket is a collection of repositories
type Bucket interface {
// Add adds the URI to the repository bucket
Add(uri string) error
// Remove removes the URI from the repository bucket
Remove(uri string) error
// Poll polls all the repositories in the repository bucket.
Poll() []error
// Find finds the repository using the URI
Find(uri string) (Repository, error)
// List returns all the repositories in the repository bucket.
List() []Repository
}
// Repository contains multiple versions of one template.
type Repository interface {
// Versions return the known versions
Versions() ([]string, error)
// Poll updates the internal cache
Poll() error
// Name returns the name of the repository
Name() string
// URI returns the URI of the repository
URI() string
// Key returns the key based on the given version. When the version is not found ErrNotFound is returned.
Key(version string) (string, error)
// Template returns the template based on the given key.
// To get a key use Key. When the key is not found ErrNotFound is returned.
Template(key string) (Template, error)
}
// Template of the simulator
type Template interface {
simulator.Info
// Create ensures that all the data is available.
Create() error
// Destroy removes all the template data.
Destroy() error
}