-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/subscriber: Interfaces in subscriber (#4145)
* feat: add interfaces to events Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: add interfaces to subscriber gql Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: add interfaces to k8s Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: add interfaces to utils Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: add interfaces to requests Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: use interfaces in main file Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: add interfaces to requests Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: add interfaces to utils Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * feat: use new interfaces Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * fix: add global variables to reciever Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * refractor: events struct to subscriberEvents Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * refractor: gql struct nd getter Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * refractor: subscriber k8s object getter Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * refractor: define local vars with := Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> * fix: absent event in event interface Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com> --------- Signed-off-by: SohamRatnaparkhi <soham.ratnaparkhi@gmail.com>
- Loading branch information
1 parent
f2275e4
commit d4550bd
Showing
16 changed files
with
267 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package events | ||
|
||
import ( | ||
"subscriber/pkg/graphql" | ||
"subscriber/pkg/types" | ||
|
||
"subscriber/pkg/k8s" | ||
|
||
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" | ||
v1alpha13 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" | ||
v1alpha12 "github.com/litmuschaos/chaos-operator/pkg/client/clientset/versioned/typed/litmuschaos/v1alpha1" | ||
) | ||
|
||
type SubscriberEvents interface { | ||
ChaosEventWatcher(stopCh chan struct{}, stream chan types.WorkflowEvent, infraData map[string]string) | ||
StopChaosEngineState(namespace string, workflowRunID *string) error | ||
CheckChaosData(nodeStatus v1alpha13.NodeStatus, workflowNS string, chaosClient *v1alpha12.LitmuschaosV1alpha1Client) (string, *types.ChaosData, error) | ||
GetWorkflowObj(uid string) (*v1alpha1.Workflow, error) | ||
ListWorkflowObject(wfid string) (*v1alpha1.WorkflowList, error) | ||
GenerateWorkflowPayload(cid, accessKey, version, completed string, wfEvent types.WorkflowEvent) ([]byte, error) | ||
WorkflowEventWatcher(stopCh chan struct{}, stream chan types.WorkflowEvent, infraData map[string]string) | ||
WorkflowEventHandler(workflowObj *v1alpha1.Workflow, eventType string, startTime int64) (types.WorkflowEvent, error) | ||
SendWorkflowUpdates(infraData map[string]string, event types.WorkflowEvent) (string, error) | ||
WorkflowUpdates(infraData map[string]string, event chan types.WorkflowEvent) | ||
StopWorkflow(wfName string, namespace string) error | ||
} | ||
|
||
type subscriberEvents struct { | ||
gqlSubscriberServer graphql.SubscriberGql | ||
subscriberK8s k8s.SubscriberK8s | ||
} | ||
|
||
func NewSubscriberEventsOperator(gqlSubscriberServer graphql.SubscriberGql, subscriberK8s k8s.SubscriberK8s) SubscriberEvents { | ||
return &subscriberEvents{ | ||
gqlSubscriberServer: gqlSubscriberServer, | ||
subscriberK8s: subscriberK8s, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package graphql | ||
|
||
type SubscriberGql interface { | ||
SendRequest(server string, payload []byte) (string, error) | ||
MarshalGQLData(gqlData interface{}) (string, error) | ||
} | ||
|
||
type subscriberGql struct { | ||
} | ||
|
||
func NewSubscriberGql() SubscriberGql { | ||
return &subscriberGql{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.