github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/runtime/setup/events/events.go (about)

     1  package events
     2  
     3  import (
     4  	"github.com/go-openapi/strfmt"
     5  )
     6  
     7  /*
     8  These events are intentionally low level and with minimal abstraction so as to avoid this mechanic becoming unwieldy.
     9  The naming format of events should be in the form of <Component>[<Action>]<Outcome>.
    10  */
    11  
    12  type Handler interface {
    13  	Handle(ev Eventer) error
    14  	Close() error
    15  }
    16  
    17  type VoidHandler struct {
    18  }
    19  
    20  func (v *VoidHandler) Handle(Eventer) error {
    21  	return nil
    22  }
    23  
    24  func (v *VoidHandler) Close() error {
    25  	return nil
    26  }
    27  
    28  type Event struct{}
    29  
    30  type Eventer interface {
    31  	IsEvent() Event
    32  }
    33  
    34  type Start struct {
    35  	RecipeID strfmt.UUID
    36  
    37  	RequiresBuild bool
    38  	Artifacts     map[strfmt.UUID]string
    39  	LogFilePath   string
    40  
    41  	ArtifactsToBuild    []strfmt.UUID
    42  	ArtifactsToDownload []strfmt.UUID
    43  	ArtifactsToInstall  []strfmt.UUID
    44  }
    45  
    46  func (Start) IsEvent() Event {
    47  	return Event{}
    48  }
    49  
    50  type Success struct {
    51  }
    52  
    53  func (Success) IsEvent() Event {
    54  	return Event{}
    55  }
    56  
    57  type Failure struct {
    58  }
    59  
    60  func (Failure) IsEvent() Event {
    61  	return Event{}
    62  }
    63  
    64  type BuildSkipped struct {
    65  }
    66  
    67  func (BuildSkipped) IsEvent() Event {
    68  	return Event{}
    69  }
    70  
    71  type BuildStarted struct {
    72  	LogFilePath string
    73  }
    74  
    75  func (BuildStarted) IsEvent() Event {
    76  	return Event{}
    77  }
    78  
    79  type BuildSuccess struct {
    80  }
    81  
    82  func (BuildSuccess) IsEvent() Event {
    83  	return Event{}
    84  }
    85  
    86  type BuildFailure struct {
    87  	Message string
    88  }
    89  
    90  func (BuildFailure) IsEvent() Event {
    91  	return Event{}
    92  }
    93  
    94  type ArtifactBuildStarted struct {
    95  	ArtifactID strfmt.UUID
    96  	FromCache  bool
    97  }
    98  
    99  func (ArtifactBuildStarted) IsEvent() Event {
   100  	return Event{}
   101  }
   102  
   103  type ArtifactBuildProgress struct {
   104  	ArtifactID   strfmt.UUID
   105  	LogTimestamp string
   106  	LogLevel     string // eg. (INFO/ERROR/...)
   107  	LogChannel   string // channel through which this log line was generated (stdout/stderr/...)
   108  	LogMessage   string
   109  	LogSource    string // source of this log (eg., builder/build-wrapper/...)
   110  }
   111  
   112  func (ArtifactBuildProgress) IsEvent() Event {
   113  	return Event{}
   114  }
   115  
   116  type ArtifactBuildFailure struct {
   117  	ArtifactID   strfmt.UUID
   118  	LogURI       string
   119  	ErrorMessage string
   120  }
   121  
   122  func (ArtifactBuildFailure) IsEvent() Event {
   123  	return Event{}
   124  }
   125  
   126  type ArtifactBuildSuccess struct {
   127  	ArtifactID strfmt.UUID
   128  	LogURI     string
   129  }
   130  
   131  func (ArtifactBuildSuccess) IsEvent() Event {
   132  	return Event{}
   133  }
   134  
   135  type ArtifactDownloadStarted struct {
   136  	ArtifactID strfmt.UUID
   137  	TotalSize  int
   138  }
   139  
   140  func (ArtifactDownloadStarted) IsEvent() Event {
   141  	return Event{}
   142  }
   143  
   144  type ArtifactDownloadSkipped struct {
   145  	ArtifactID strfmt.UUID
   146  }
   147  
   148  func (ArtifactDownloadSkipped) IsEvent() Event {
   149  	return Event{}
   150  }
   151  
   152  type ArtifactDownloadProgress struct {
   153  	ArtifactID      strfmt.UUID
   154  	IncrementBySize int
   155  }
   156  
   157  func (ArtifactDownloadProgress) IsEvent() Event {
   158  	return Event{}
   159  }
   160  
   161  type ArtifactDownloadFailure struct {
   162  	ArtifactID strfmt.UUID
   163  	Error      error
   164  }
   165  
   166  func (ArtifactDownloadFailure) IsEvent() Event {
   167  	return Event{}
   168  }
   169  
   170  type ArtifactDownloadSuccess struct {
   171  	ArtifactID strfmt.UUID
   172  }
   173  
   174  func (ArtifactDownloadSuccess) IsEvent() Event {
   175  	return Event{}
   176  }
   177  
   178  type ArtifactInstallStarted struct {
   179  	ArtifactID strfmt.UUID
   180  	TotalSize  int
   181  }
   182  
   183  func (ArtifactInstallStarted) IsEvent() Event {
   184  	return Event{}
   185  }
   186  
   187  type ArtifactInstallProgress struct {
   188  	ArtifactID      strfmt.UUID
   189  	IncrementBySize int
   190  }
   191  
   192  func (ArtifactInstallSkipped) IsEvent() Event {
   193  	return Event{}
   194  }
   195  
   196  type ArtifactInstallSkipped struct {
   197  	ArtifactID strfmt.UUID
   198  }
   199  
   200  func (ArtifactInstallProgress) IsEvent() Event {
   201  	return Event{}
   202  }
   203  
   204  type ArtifactInstallFailure struct {
   205  	ArtifactID strfmt.UUID
   206  	Error      error
   207  }
   208  
   209  func (ArtifactInstallFailure) IsEvent() Event {
   210  	return Event{}
   211  }
   212  
   213  type ArtifactInstallSuccess struct {
   214  	ArtifactID strfmt.UUID
   215  }
   216  
   217  func (ArtifactInstallSuccess) IsEvent() Event {
   218  	return Event{}
   219  }
   220  
   221  type SolveStart struct{}
   222  
   223  func (SolveStart) IsEvent() Event {
   224  	return Event{}
   225  }
   226  
   227  type SolveError struct {
   228  	Error error
   229  }
   230  
   231  func (SolveError) IsEvent() Event {
   232  	return Event{}
   233  }
   234  
   235  type SolveSuccess struct{}
   236  
   237  func (SolveSuccess) IsEvent() Event {
   238  	return Event{}
   239  }