hook

package
v1.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logs added in v1.15.0

func Logs(id, name, base string) (*os.File, error)

Logs get hook log with its name and id

func ResolveScript

func ResolveScript(dir, name, defaultExt string) (string, error)

ResolveScript is resolving the target script.

Types

type Job added in v1.15.0

type Job struct {
	MessageChan chan []byte
	// contains filtered or unexported fields
}

Job a hook job

func NewHookJob added in v1.15.0

func NewHookJob(request *Request) (*Job, error)

NewHookJob creates new hook job

func (*Job) Close added in v1.15.0

func (job *Job) Close()

Close job message chan

func (*Job) Err added in v1.15.0

func (job *Job) Err() error

Err returns job error

func (*Job) ID added in v1.15.0

func (job *Job) ID() uint64

ID returns job ID

func (*Job) IsTerminated added in v1.15.0

func (job *Job) IsTerminated() bool

IsTerminated ask if the job is terminated

func (*Job) Logs added in v1.15.0

func (job *Job) Logs(prefixFilter string) string

Logs returns job logs filtered with the prefix

func (*Job) Meta added in v1.15.0

func (job *Job) Meta() []string

Meta returns job meta

func (*Job) Name added in v1.15.0

func (job *Job) Name() string

Name returns job name

func (*Job) Run added in v1.15.0

func (job *Job) Run() error

Run hook job

func (*Job) SendMessage added in v1.15.0

func (job *Job) SendMessage(message string)

SendMessage send message to the message channel

func (*Job) Status added in v1.15.0

func (job *Job) Status() Status

Status get job status

func (*Job) StatusLabel added in v1.15.0

func (job *Job) StatusLabel() string

StatusLabel return job status as string

func (*Job) Terminate added in v1.15.0

func (job *Job) Terminate(err error) error

Terminate set job as terminated

type Request added in v1.15.0

type Request struct {
	Name      string
	Script    string
	Method    string
	Payload   string
	Args      []string
	Timeout   int
	OutputDir string
}

Request is a hook request

type Status added in v1.15.0

type Status int

Status is the status of a hook

const (
	// Idle means that the hook is not yet started
	Idle Status = iota
	// Running means that the hook is running
	Running
	// Success means that the hook over
	Success
	// Error means that the hook is over but in error
	Error
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL