Skip to content

Commit

Permalink
add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanda committed Mar 19, 2020
1 parent 9db7032 commit c2e245b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions reaper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (c *Client) GetCluster(ctx context.Context, name string) (*Cluster, error)
return cluster, nil
}

// Fetches all clusters. This function is async and may return before any or all results are
// available. The concurrency is currently determined by min(5, NUM_CPUS).
func (c *Client) GetClusters(ctx context.Context) <-chan GetClusterResult {
// TODO Make the concurrency configurable
concurrency := int(math.Min(5, float64(runtime.NumCPU())))
Expand Down Expand Up @@ -98,6 +100,8 @@ func (c *Client) GetClusters(ctx context.Context) <-chan GetClusterResult {
return results
}

// Fetches all clusters in a synchronous or blocking manner. Note that this function fails
// fast if there is an error and no clusters will be returned.
func (c *Client) GetClustersSync(ctx context.Context) ([]*Cluster, error) {
clusters := make([]*Cluster, 0)

Expand Down

0 comments on commit c2e245b

Please sign in to comment.