Contains the Concourse pipeline definition for building a line-server container
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.

44 lines
724 B

  1. package main
  2. import (
  3. "time"
  4. )
  5. // Get what the unix timestamp will be in "seconds".
  6. func getFutureTimestamp(seconds int32) (ts int32) {
  7. now := int32(time.Now().Unix())
  8. if seconds == 0 {
  9. ts = 0
  10. } else {
  11. ts = now + seconds
  12. }
  13. return
  14. }
  15. // Determine if a file with expiry set to "ts" has expired yet
  16. func isTsExpired(ts int32) (expired bool) {
  17. now := int32(time.Now().Unix())
  18. if ts == 0 {
  19. expired = false
  20. } else if now > ts {
  21. expired = true
  22. } else {
  23. expired = false
  24. }
  25. return
  26. }
  27. // Determine if the given filename is expired
  28. func isFileExpired(filename string) (bool, error) {
  29. exp, err := metadataGetExpiry(filename)
  30. if err != nil {
  31. return true, err
  32. } else {
  33. return isTsExpired(exp), err
  34. }
  35. }