patrick

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: BSD-3-Clause Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Lock(jid string, eta uint32) error
	IsLocked(jid string) (bool, error)
	Unlock(jid string) error
	Done(jid string, cid_log map[string]string, assetCid map[string]string) error
	Failed(jid string, cid_log map[string]string, assetCid map[string]string) error
	List() ([]string, error)
	Get(jid string) (*Job, error)
	Timeout(jid string) error
	Cancel(jid string, cid_log map[string]string) (interface{}, error)
	DatabaseStats() (kvdb.Stats, error)
	Peers(...peerCore.ID) Client
	Close()
}

type DelayConfig

type DelayConfig struct {
	Time int `cbor:"1,keyasint"` // Inject delay in second
}

type GitRepository

type GitRepository interface {
	Url() *string
	Clone(ctx context.Context, path string, ref string) error
	Path() string
}

type HeadCommit

type HeadCommit struct {
	ID string `json:"id" cbor:"33,keyasint"`
}

type Job

type Job struct {
	Id        string    `cbor:"1,keyasint"`
	Timestamp int64     `cbor:"2,keyasint"`
	Status    JobStatus `cbor:"3,keyasint"`
	LogLock   sync.Mutex
	Logs      map[string]string `cbor:"11,keyasint"` // Cid of logs
	Meta      Meta              `cbor:"15,keyasint"`
	CidLock   sync.Mutex
	AssetCid  map[string]string `cbor:"20,keyasint"` // Build Cid
	Attempt   int               `cbor:"30,keyasint"`
	Delay     *DelayConfig      `cbor:"99,keyasint"` // Inject a delay to run a job
}

func (*Job) SetCid

func (j *Job) SetCid(key, value string)

func (*Job) SetLog

func (j *Job) SetLog(key, value string)

type JobStatus

type JobStatus int

TODO: Shouldn't JobStatus just be typed string?

const (
	JobStatusFailed JobStatus = iota - 1
	JobStatusOpen
	JobStatusLocked
	JobStatusSuccess
	JobStatusCancelled
)

func (JobStatus) String

func (s JobStatus) String() string

func (JobStatus) Unicode

func (s JobStatus) Unicode() string

type Meta

type Meta struct {
	Ref        string     `json:"ref" cbor:"4,keyasint"`
	Before     string     `json:"before" cbor:"8,keyasint"`
	After      string     `json:"after" cbor:"16,keyasint"`
	HeadCommit HeadCommit `json:"head_commit" cbor:"32,keyasint"`
	Repository Repository `cbor:"64,keyasint"`
}

TODO: optimize cbor storage

type Repository

type Repository struct {
	ID       int    `json:"id" cbor:"65,keyasint"`
	Provider string `json:"provider" cbor:"66,keyasint"`
	SSHURL   string `json:"ssh_url" cbor:"67,keyasint"`
	Branch   string `json:"default_branch" cbor:"68,keyasint"`
}

type Service

type Service interface {
	services.DBService
	NewGitRepository(provider string, repositoryId string, output io.Writer) (GitRepository, error)
}

Jump to

Keyboard shortcuts

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