@@ -3,7 +3,6 @@ package action
33import (
44 "context"
55 "fmt"
6- "os"
76
87 "github.com/LumeraProtocol/supernode/sdk/config"
98 "github.com/LumeraProtocol/supernode/sdk/event"
@@ -15,7 +14,7 @@ import (
1514
1615// Client defines the interface for action operations
1716type Client interface {
18- StartCascade (ctx context.Context , fileHash string , actionID string , filePath string , signedData string ) (string , error )
17+ StartCascade (ctx context.Context , data [] byte , actionID string ) (string , error )
1918 DeleteTask (ctx context.Context , taskID string ) error
2019 GetTask (ctx context.Context , taskID string ) (* task.TaskEntry , bool )
2120 SubscribeToEvents (ctx context.Context , eventType event.EventType , handler event.Handler ) error
@@ -54,36 +53,20 @@ func NewClient(ctx context.Context, config config.Config, logger log.Logger, key
5453
5554// StartCascade initiates a cascade operation
5655func (c * ClientImpl ) StartCascade (ctx context.Context ,
57- fileHash string ,
56+ data [] byte ,
5857 actionID string ,
59- filePath string ,
60- signedData string ,
6158) (string , error ) {
62- c .logger .Debug (ctx , "Starting cascade operation" ,
63- "fileHash" , fileHash ,
64- "actionID" , actionID ,
65- "filePath" , filePath ,
66- )
67-
68- if fileHash == "" {
69- c .logger .Error (ctx , "Empty file hash provided" )
70- return "" , ErrEmptyFileHash
71- }
59+
7260 if actionID == "" {
7361 c .logger .Error (ctx , "Empty action ID provided" )
7462 return "" , ErrEmptyActionID
7563 }
76- if filePath == "" {
77- c .logger .Error (ctx , "Empty file path provided" )
78- return "" , ErrEmptyFilePath
79- }
80- _ , err := os .Stat (filePath )
81- if err != nil {
82- c .logger .Error (ctx , "File not found" , "filePath" , filePath )
83- return "" , ErrEmptyFileNotFound
64+ if len (data ) == 0 {
65+ c .logger .Error (ctx , "Empty data provided" )
66+ return "" , ErrEmptyData
8467 }
8568
86- taskID , err := c .taskManager .CreateCascadeTask (ctx , fileHash , actionID , filePath , signedData )
69+ taskID , err := c .taskManager .CreateCascadeTask (ctx , data , actionID )
8770 if err != nil {
8871 c .logger .Error (ctx , "Failed to create cascade task" , "error" , err )
8972 return "" , fmt .Errorf ("failed to create cascade task: %w" , err )
0 commit comments