Documentation ¶
Index ¶
- func Checksum(data []byte) string
- func ChecksumFile(path string) (sum string, err error)
- func Cli(opts util.Options, args []string) error
- func CreateDefaultPool(runners int)
- func DeleteImage(img *Image, db *db, destdir string) error
- func FileServer(r chi.Router, path string, root http.FileSystem)
- func MkdirParents(filename string) error
- func PathAbs(rootdir, path string) string
- func ProcessImage(img *Image, scriptname string, db *db, destdir string) (err error)
- func RunCmdChain(c *CmdChain, s *Status) (err error)
- func SetupLogging()
- func StartWeb(o util.Options) (err error)
- type Cmd
- type CmdChain
- type Environment
- type Image
- type ImageResult
- type Job
- type Link
- type Page
- type PageResult
- type Query
- type Runner
- type RunnerPool
- type Script
- type Search
- type Status
- type Tag
- type Token
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChecksumFile ¶
func CreateDefaultPool ¶
func CreateDefaultPool(runners int)
func DeleteImage ¶
DeleteImage deletes the image's files and data from the database
func FileServer ¶
func FileServer(r chi.Router, path string, root http.FileSystem)
FileServer conveniently sets up a http.FileServer handler to serve static files from a http.FileSystem. As chi updated to 3.x, the equivalent function was removed. This one is copied from the example in: https://github.com/go-chi/chi/blob/master/_examples/fileserver/main.go
func MkdirParents ¶
MkdirParents creates all parent directories of the given path or returns an error if they couldn't be created
func ProcessImage ¶
func RunCmdChain ¶
func SetupLogging ¶
func SetupLogging()
Types ¶
type Cmd ¶
type Cmd struct {
Cmd []string
}
func (*Cmd) Validate ¶
func (c *Cmd) Validate(e *Environment) (err error)
Validate makes sure the command is proper and can be run
type CmdChain ¶
type CmdChain struct { //TODO remove this (this should come from outside) Environment Links []Link }
func NewCmdChainScript ¶
NewCmdChainScript creates a CmdChain from a script where each command is on a separate line. The following syntax elements are supported:
- Empty lines are filtered out.
- Comments start with # and end with EOL.
- Constants are strings that begin with $ and they can be set before running the cmdchain.
- Temporary files are strings that start with $tmp and they are automatically created before running the cmdchain and removed afterwards.
func (*CmdChain) Validate ¶
func (c *CmdChain) Validate(e *Environment) (err error)
type Environment ¶
type Environment struct { // Constants are variables that are defined before a command chain is run Constants map[string]string // Tempfiles are constants that house a name of a temporary file. The // files are created before the chain is run and they are removed at // the end. TempFiles []string // The directory where the commands are run. This is a created // temporary directory RootDir string // AllowedCommands contain the commands that are allowed. If this is // nil, all commands are allowed. AllowedCommands map[string]bool // contains filtered or unexported fields }
Environment is the run environment for each command. It is supplied as part of Status for a Link when it is Run or Validated.
type Image ¶
type Image struct { // in img Id int Checksum string Fileid string ScanDate time.Time AddDate time.Time InterpretDate time.Time ProcessLog string Filename string // in imgtext Text string Comment string // in tags Tags []Tag }
type ImageResult ¶ added in v0.8.0
type ImageResult struct { PageResult Images []Image }
type Page ¶
type Page struct { // Id that was the last of the previous page SinceId int // Count is the number of items in the page Count int }
Pagination support
type PageResult ¶ added in v0.8.0
type PageResult struct { // Number of items returned by the whole search ResultCount int // IDs of the items that are the first of their page SinceIDs []int // Count is the number of items in the page Count int }
PageResult adds navigation information to the paginated data
type Runner ¶
func CreateRunner ¶
type RunnerPool ¶
type RunnerPool struct {
// contains filtered or unexported fields
}
var Pool *RunnerPool
func CreatePool ¶
func CreatePool(runners int) RunnerPool
func (*RunnerPool) Delete ¶
func (pool *RunnerPool) Delete()
func (*RunnerPool) Do ¶
func (pool *RunnerPool) Do(job Job)
type Status ¶
type Status struct { // The log output will be written to this Log io.Writer Environment }
Status is the runtime status of the command chain