diff options
| author | Jeff Carr <[email protected]> | 2025-02-22 19:11:51 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-22 19:11:51 -0600 |
| commit | a72e9ce5f4062fb78c82f1380d7a86ee4cc47294 (patch) | |
| tree | 546112fe224fbaec50666a61d3ccab102081acc4 /ideas/interface.go | |
| parent | 3ab156a9c477f4d839e1384d424856519390b797 (diff) | |
NEVER LEAVE JUNK IN GO REPOS EVERv0.22.92v0.22.91v0.22.90v0.22.89v0.22.88v0.22.87v0.22.86v0.22.85v0.22.84v0.22.83v0.22.82v0.22.81v0.22.80v0.22.79v0.22.78v0.22.77v0.22.76v0.22.75v0.22.74v0.22.73v0.22.72v0.22.71v0.22.70v0.22.69v0.22.68v0.22.67v0.22.66v0.22.65v0.22.64v0.22.63v0.22.62v0.22.61v0.22.60v0.22.59
Diffstat (limited to 'ideas/interface.go')
| -rw-r--r-- | ideas/interface.go | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/ideas/interface.go b/ideas/interface.go deleted file mode 100644 index 3189a5b..0000000 --- a/ideas/interface.go +++ /dev/null @@ -1,95 +0,0 @@ -package repolist - -// attempt to make a golang 'interface' for a 'view' of git repos - -import ( - "context" - "errors" - "fmt" - - "go.wit.com/lib/protobuf/virtbuf" -) - -// ViewRepoManager is a concrete implementation of the RepoManager interface. -type ViewRepoManager struct { - // client represents a hypothetical API client for interacting with the cloud. - client ViewAPIClient -} - -// ViewAPIClient defines the methods required from the API client. -// This is useful if you want to mock this client for testing. -type ViewAPIClient interface { - GetRepoByName(ctx context.Context, name string) (*virtbuf.Cluster, error) - StartRepo(ctx context.Context, clusterID string) error - StopRepo(ctx context.Context, clusterID string) error - ListRepos(ctx context.Context) ([]*virtbuf.Cluster, error) - GetRepoStatus(ctx context.Context, clusterID string) (string, error) -} - -// NewViewRepoManager creates a new ViewRepoManager with the provided API client. -func NewViewRepoManager(client ViewAPIClient) *ViewRepoManager { - return &ViewRepoManager{client: client} -} - -// FindByName retrieves a cluster by name. -func (m *ViewRepoManager) FindByName(ctx context.Context, name string) (*virtbuf.Cluster, error) { - cluster, err := m.client.GetRepoByName(ctx, name) - if err != nil { - return nil, fmt.Errorf("error finding cluster by name %q: %w", name, err) - } - return cluster, nil -} - -// Start initiates the startup process for the specified cluster. -func (m *ViewRepoManager) Start(ctx context.Context, cluster *virtbuf.Cluster) error { - if cluster == nil { - return errors.New("cluster cannot be nil") - } - /* - err := m.client.StartRepo(ctx, cluster.Id) - if err != nil { - return fmt.Errorf("error starting cluster %q: %w", cluster.Id, err) - } - */ - return nil -} - -// Stop halts the specified cluster. -func (m *ViewRepoManager) Stop(ctx context.Context, cluster *virtbuf.Cluster) error { - if cluster == nil { - return errors.New("cluster cannot be nil") - } - /* - err := m.client.StopRepo(ctx, cluster.Id) - if err != nil { - return fmt.Errorf("error stopping cluster %q: %w", cluster.Id, err) - } - */ - return nil -} - -// List retrieves all available clusters. -func (m *ViewRepoManager) List(ctx context.Context) ([]*virtbuf.Cluster, error) { - /* - clusters, err := m.client.ListRepos(ctx) - if err != nil { - return nil, fmt.Errorf("error listing clusters: %w", err) - } - return clusters, nil - */ - return nil, errors.New("List not done yet") -} - -// Status checks the current status of a specified cluster. -func (m *ViewRepoManager) Status(ctx context.Context, cluster *virtbuf.Cluster) (string, error) { - if cluster == nil { - return "", errors.New("cluster cannot be nil") - } - /* - status, err := m.client.GetRepoStatus(ctx, cluster.Id) - if err != nil { - return "", fmt.Errorf("error getting status of cluster %q: %w", cluster.Id, err) - } - */ - return "", nil -} |
