SyncReady checks whether a unit is ready to be started. That is, all dependencies are satisfied.
(_ context.Context, req *proto.SyncReadyRequest)
| 117 | |
| 118 | // SyncReady checks whether a unit is ready to be started. That is, all dependencies are satisfied. |
| 119 | func (s *DRPCAgentSocketService) SyncReady(_ context.Context, req *proto.SyncReadyRequest) (*proto.SyncReadyResponse, error) { |
| 120 | if s.unitManager == nil { |
| 121 | return nil, xerrors.Errorf("cannot check readiness: %w", ErrUnitManagerNotAvailable) |
| 122 | } |
| 123 | |
| 124 | unitID := unit.ID(req.Unit) |
| 125 | isReady, err := s.unitManager.IsReady(unitID) |
| 126 | if err != nil { |
| 127 | return nil, xerrors.Errorf("cannot check readiness: %w", err) |
| 128 | } |
| 129 | |
| 130 | return &proto.SyncReadyResponse{ |
| 131 | Ready: isReady, |
| 132 | }, nil |
| 133 | } |
| 134 | |
| 135 | // SyncStatus gets the status of a unit and lists its dependencies. |
| 136 | func (s *DRPCAgentSocketService) SyncStatus(_ context.Context, req *proto.SyncStatusRequest) (*proto.SyncStatusResponse, error) { |