diff options
| author | 2023-04-28 01:36:55 +0800 | |
|---|---|---|
| committer | 2023-04-28 01:36:55 +0800 | |
| commit | fc8c5fdce62fb229202659408798a7b6c98f6e8b (patch) | |
| tree | 7554f80e50de4af6fd255afa7c21bcdd58a7af34 /cli/internal/daemonclient/daemonclient.go | |
| parent | dd84b9d64fb98746a230cd24233ff50a562c39c9 (diff) | |
| download | HydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.tar.gz HydroRoll-fc8c5fdce62fb229202659408798a7b6c98f6e8b.zip | |
Diffstat (limited to 'cli/internal/daemonclient/daemonclient.go')
| -rw-r--r-- | cli/internal/daemonclient/daemonclient.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/cli/internal/daemonclient/daemonclient.go b/cli/internal/daemonclient/daemonclient.go deleted file mode 100644 index c415cd3..0000000 --- a/cli/internal/daemonclient/daemonclient.go +++ /dev/null @@ -1,70 +0,0 @@ -// Package daemonclient is a wrapper around a grpc client -// to talk to turbod -package daemonclient - -import ( - "context" - - "github.com/vercel/turbo/cli/internal/daemon/connector" - "github.com/vercel/turbo/cli/internal/fs" - "github.com/vercel/turbo/cli/internal/turbodprotocol" - "github.com/vercel/turbo/cli/internal/turbopath" -) - -// DaemonClient provides access to higher-level functionality from the daemon to a turbo run. -type DaemonClient struct { - client *connector.Client -} - -// Status provides details about the daemon's status -type Status struct { - UptimeMs uint64 `json:"uptimeMs"` - LogFile turbopath.AbsoluteSystemPath `json:"logFile"` - PidFile turbopath.AbsoluteSystemPath `json:"pidFile"` - SockFile turbopath.AbsoluteSystemPath `json:"sockFile"` -} - -// New creates a new instance of a DaemonClient. -func New(client *connector.Client) *DaemonClient { - return &DaemonClient{ - client: client, - } -} - -// GetChangedOutputs implements runcache.OutputWatcher.GetChangedOutputs -func (d *DaemonClient) GetChangedOutputs(ctx context.Context, hash string, repoRelativeOutputGlobs []string) ([]string, error) { - resp, err := d.client.GetChangedOutputs(ctx, &turbodprotocol.GetChangedOutputsRequest{ - Hash: hash, - OutputGlobs: repoRelativeOutputGlobs, - }) - if err != nil { - return nil, err - } - - return resp.ChangedOutputGlobs, nil -} - -// NotifyOutputsWritten implements runcache.OutputWatcher.NotifyOutputsWritten -func (d *DaemonClient) NotifyOutputsWritten(ctx context.Context, hash string, repoRelativeOutputGlobs fs.TaskOutputs) error { - _, err := d.client.NotifyOutputsWritten(ctx, &turbodprotocol.NotifyOutputsWrittenRequest{ - Hash: hash, - OutputGlobs: repoRelativeOutputGlobs.Inclusions, - OutputExclusionGlobs: repoRelativeOutputGlobs.Exclusions, - }) - return err -} - -// Status returns the DaemonStatus from the daemon -func (d *DaemonClient) Status(ctx context.Context) (*Status, error) { - resp, err := d.client.Status(ctx, &turbodprotocol.StatusRequest{}) - if err != nil { - return nil, err - } - daemonStatus := resp.DaemonStatus - return &Status{ - UptimeMs: daemonStatus.UptimeMsec, - LogFile: d.client.LogPath, - PidFile: d.client.PidPath, - SockFile: d.client.SockPath, - }, nil -} |
