// operateRelayStage returns RelayOp.String() additionally to record metrics
// *RelayOp is nil only when error is nil, so record on error will not meet nil-pointer deference.
operateRelayStage returns RelayOp.String() additionally to record metrics
*RelayOp is nil only when error is nil, so record on error will not meet nil-pointer deference.
// operateRelayStage returns RelayOp . String () additionally to record metrics // * RelayOp is nil only when error is nil so record on error will not meet nil - pointer deference .
func (w *SourceWorker) operateRelayStage(ctx context.Context, stage ha.Stage) (string, error) {
	var op pb.RelayOp
	switch {
	case stage.Expect == pb.Stage_Running:
		if w.relayHolder.Stage() == pb.Stage_New {
			w.relayHolder.Start()
			w.relayPurger.Start()
			return opErrTypeBeforeOp, nil
		}
		op = pb.RelayOp_ResumeRelay
	case stage.Expect == pb.Stage_Paused:
		op = pb.RelayOp_PauseRelay
	case stage.IsDeleted:
		op = pb.RelayOp_StopRelay
	}
	return op.String(), w.operateRelay(ctx, op)
}
func ( w * SourceWorker ) operateRelayStage ( ctx context . Context , stage ha . Stage ) ( string , error ) { var op pb . RelayOp switch { case stage . Expect == pb . Stage_Running : if w . relayHolder . Stage ( ) == pb . Stage_New { w . relayHolder . Start ( ) w . relayPurger . Start ( ) return opErrTypeBeforeOp , nil } op = pb . RelayOp_ResumeRelay case stage . Expect == pb . Stage_Paused : op = pb . RelayOp_PauseRelay case stage . IsDeleted : op = pb . RelayOp_StopRelay } return op . String ( ) , w . operateRelay ( ctx , op ) }
operateRelayStage returns RelayOp.String() additionally to record metrics
RelayOp is nil only when error is nil, so record on error will not meet nil-pointer deference.
operateRelayStage returns RelayOp . String () additionally to record metrics RelayOp is nil only when error is nil so record on error will not meet nil - pointer deference .