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.

40 lines
658 B

  1. package main
  2. import (
  3. "time"
  4. )
  5. // Get what the unix timestamp will be in "seconds".
  6. func getFutureTimestamp(seconds int64) (ts int64) {
  7. now := int64(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 int64) (expired bool) {
  17. now := int64(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 {
  29. exp, _ := metadataGetExpiry(filename)
  30. return isTsExpired(exp)
  31. }