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.
|
|
package main
import ( "flag" "log"
"github.com/andreimarcu/linx-server/backends/localfs" "github.com/andreimarcu/linx-server/backends/metajson" "github.com/andreimarcu/linx-server/expiry" )
func main() { var filesDir string var metaDir string var noLogs bool
flag.StringVar(&filesDir, "filespath", "files/", "path to files directory") flag.StringVar(&metaDir, "metapath", "meta/", "path to metadata directory") flag.BoolVar(&noLogs, "nologs", false, "don't log deleted files")
metaStorageBackend := localfs.NewLocalfsBackend(metaDir) metaBackend := metajson.NewMetaJSONBackend(metaStorageBackend) fileBackend := localfs.NewLocalfsBackend(filesDir)
files, err := metaStorageBackend.List() if err != nil { panic(err) }
for _, filename := range files { metadata, err := metaBackend.Get(filename) if err != nil { log.Printf("Failed to find metadata for %s", filename) }
if expiry.IsTsExpired(metadata.Expiry) { log.Printf("Delete %s", filename) fileBackend.Delete(filename) metaStorageBackend.Delete(filename) } } }
|