@@ -14,45 +14,31 @@ type EventType string
1414// These events are used to track the progress of tasks
1515// and to notify subscribers about important changes in the system.
1616const (
17- TaskStarted EventType = "task.started"
18- TaskProgressActionVerified EventType = "task.progress.action_verified"
19- TaskProgressActionVerificationFailed EventType = "task.progress.action_verification_failed"
20- TaskProgressSupernodesFound EventType = "task.progress.supernode_found"
21- TaskProgressSupernodesUnavailable EventType = "task.progress.supernodes_unavailable"
22- TaskProgressActionRetrievedBySupernode EventType = "task.progress.action_retrieved_by_supernode"
23- TaskProgressActionFeeValidated EventType = "task.progress.action_fee_validated"
24- TaskProgressTopSupernodeCheckValidated EventType = "task.progress.top_sn_check_validated"
25- TaskProgressArtefactsStored EventType = "task.progress.artefacts_stored"
26- TaskProgressCascadeMetadataDecoded EventType = "task.progress.cascade_metadata_decoded"
27- TaskProgressDataHashVerified EventType = "task.progress.data_hash_verified"
28- TaskProgressInputDataEncoded EventType = "task.progress.input_data_encoded"
29- TaskProgressSignatureVerified EventType = "task.progress.signature_verified"
30- TaskProgressRQIDFilesGenerated EventType = "task.progress.rq_id_files_generated"
31- TaskProgressRQIDsVerified EventType = "task.progress.rq_ids_verified"
32- TaskProgressActionFinalized EventType = "task.progress.action_finalized"
33- TaskProgressRegistrationInProgress EventType = "task.progress.registration_in_progress"
34- TaskProgressRegistrationFailure EventType = "task.progress.registration_failure"
35- TaskProgressRegistrationSuccessful EventType = "task.progress.registration_successful"
36- TaskCompleted EventType = "task.completed"
37- TxhasReceived EventType = "txhash.received"
38- TaskFailed EventType = "task.failed"
17+ SDKTaskStarted EventType = "sdk:started"
18+ SDKSupernodesUnavailable EventType = "sdk:supernodes_unavailable"
19+ SDKSupernodesFound EventType = "sdk:supernodes_found"
20+ SDKRegistrationAttemp EventType = "sdk:registration_in_progress"
21+ SDKRegistrationFailure EventType = "sdk:registration_failure"
22+ SDKRegistrationSuccessful EventType = "sdk:registration_successful"
23+ SDKTaskTxHashReceived EventType = "sdk:txhash_received"
24+ SDKTaskCompleted EventType = "sdk:completed"
25+ SDKTaskFailed EventType = "sdk:failed"
3926)
4027
41- // Task progress steps in order
42- // This is the order in which events are expected to occur
43- // during the task lifecycle. It is used to track progress.
44- // The order of events in this slice should match the order
45- // in which they are expected to occur in the task lifecycle.
46- // The index of each event in this slice represents its
47- // position in the task lifecycle. The first event in the slice is the
48- // first event that should be emitted when a task starts.
49- var taskProgressSteps = []EventType {
50- TaskStarted ,
51- TaskProgressActionVerified ,
52- TaskProgressSupernodesFound ,
53- TaskProgressRegistrationInProgress ,
54- TaskCompleted ,
55- }
28+ const (
29+ SupernodeActionRetrieved EventType = "supernode:action_retrieved"
30+ SupernodeActionFeeVerified EventType = "supernode:action_fee_verified"
31+ SupernodeTopCheckPassed EventType = "supernode:top_check_passed"
32+ SupernodeMetadataDecoded EventType = "supernode:metadata_decoded"
33+ SupernodeDataHashVerified EventType = "supernode:data_hash_verified"
34+ SupernodeInputEncoded EventType = "supernode:input_encoded"
35+ SupernodeSignatureVerified EventType = "supernode:signature_verified"
36+ SupernodeRQIDGenerated EventType = "supernode:rqid_generated"
37+ SupernodeRQIDVerified EventType = "supernode:rqid_verified"
38+ SupernodeArtefactsStored EventType = "supernode:artefacts_stored"
39+ SupernodeActionFinalized EventType = "supernode:action_finalized"
40+ SupernodeUnknown EventType = "supernode:unknown"
41+ )
5642
5743// EventData is a map of event data attributes using standardized keys
5844type EventData map [EventDataKey ]any
@@ -87,14 +73,3 @@ func NewEvent(ctx context.Context, eventType EventType, taskID, taskType string,
8773 ActionID : actionID ,
8874 }
8975}
90-
91- // GetTaskProgress returns current progress as (y, x), where y = current step number, x = total steps.
92- func GetTaskProgress (current EventType ) (int , int ) {
93- for idx , step := range taskProgressSteps {
94- if step == current {
95- return idx + 1 , len (taskProgressSteps )
96- }
97- }
98- // Unknown event, treat as 0 progress
99- return 0 , len (taskProgressSteps )
100- }
0 commit comments