Micro-service for file storage and processing written in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
944 B

  1. package main
  2. import (
  3. "encoding/json"
  4. )
  5. var Pipelines []Pipeline
  6. type PipelineType int
  7. type PipelineStepType int
  8. const (
  9. Image PipelineType = iota
  10. Video
  11. )
  12. const (
  13. Resize PipelineStepType = iota
  14. Compress
  15. Encode
  16. )
  17. type Pipeline struct {
  18. Name string
  19. Type PipelineType
  20. RemoveMetadata bool
  21. Steps []Step
  22. }
  23. type Step struct {
  24. Name string
  25. Type PipelineStepType
  26. }
  27. func DeserializePipelines(pipelines [][]byte) []Pipeline {
  28. values := make([]Pipeline, len(pipelines))
  29. for index, pipeline := range pipelines {
  30. var deserializedObject Pipeline
  31. json.Unmarshal(pipeline, &deserializedObject)
  32. values[index] = deserializedObject
  33. }
  34. return values
  35. }
  36. // func LoadPipelines() {
  37. // var files []string
  38. // err := filepath.Walk("./pipelines", func(path string, info fs.FileInfo, err error) error {
  39. // data, err := os.ReadFile(path)
  40. // return nil
  41. // })
  42. // if err != nil {
  43. // panic(err)
  44. // }
  45. // }