build

package
v0.0.0-...-ff69ead Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyDoing = errors.New("already doing")
	ErrAlreadyDone  = errors.New("already done")
)
View Source
var (
	ErrLimitExceeded             = errors.New("limit exceeded")
	ErrIdempotencyKeyAlreadyUsed = errors.New("idempotency key already used")
	ErrFileTooLarge              = errors.New("file too large")
)
View Source
var (
	ErrAccessDenied  = errors.New("access denied")
	ErrNotDone       = errors.New("not done")
	ErrDoneWithError = errors.New("done with error")
)
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Build

type Build struct {
	ID             uuid.UUID
	CreatedAt      time.Time
	IdempotencyKey uuid.UUID
	UserID         uuid.UUID

	Status        Status
	Error         Error
	ExitCode      int
	LogDataKey    string
	OutputDataKey string
}

type Canceler

type Canceler struct {
	DB *pgxpool.Pool
}

func NewCanceler

func NewCanceler(db *pgxpool.Pool) *Canceler

func (*Canceler) Cancel

func (c *Canceler) Cancel(ctx context.Context, params *CancelerCancelParams) (*Build, error)

type CancelerCancelParams

type CancelerCancelParams struct {
	ID     uuid.UUID
	UserID uuid.UUID
}

type Creator

type Creator struct {
	DB  *pgxpool.Pool
	MQ  *app.AMQPClient
	STG *s3.Client

	BuildsAllowed int
}

func NewCreator

func NewCreator(db *pgxpool.Pool, mq *app.AMQPClient, stg *s3.Client, params *CreatorParams) *Creator

func (*Creator) Create

func (c *Creator) Create(ctx context.Context, params *CreatorCreateParams) (*Build, error)

type CreatorCreateFileParams

type CreatorCreateFileParams struct {
	Name       string
	Type       FileType
	DataReader io.Reader
}

type CreatorCreateParams

type CreatorCreateParams struct {
	IdempotencyKey uuid.UUID
	UserID         uuid.UUID

	Files iter.Seq2[*CreatorCreateFileParams, error]
}

type CreatorParams

type CreatorParams struct {
	BuildsAllowed int
}

type Doer

type Doer struct {
	DB  *pgxpool.Pool
	STG *s3.Client
}

func NewDoer

func NewDoer(db *pgxpool.Pool, stg *s3.Client) *Doer

func (*Doer) Do

func (r *Doer) Do(ctx context.Context, params *DoerDoParams) (*Build, error)

type DoerDoParams

type DoerDoParams struct {
	ID uuid.UUID
}

type Error

type Error string
const (
	ErrorCanceled          Error = "canceled"
	ErrorExitedWithNonZero Error = "exited with non-zero"
)

func ParseError

func ParseError(s string) (errorValue Error, known bool)

type ExitError

type ExitError struct {
	ExitCode int
}

func (*ExitError) Error

func (e *ExitError) Error() string

type File

type File struct {
	ID      uuid.UUID
	BuildID uuid.UUID

	Name    string
	Type    FileType
	DataKey string
}

type FileType

type FileType string
const (
	FileTypeRegular   FileType = "regular"
	FileTypeDirectory FileType = "directory"
)

func ParseFileType

func ParseFileType(s string) (fileType FileType, known bool)

type Getter

type Getter struct {
	DB  *pgxpool.Pool
	STG *s3.Client
}

func NewGetter

func NewGetter(db *pgxpool.Pool, stg *s3.Client) *Getter

func (*Getter) CopyLogData

func (g *Getter) CopyLogData(ctx context.Context, w io.Writer, params *GetterGetParams) error

func (*Getter) CopyOutputData

func (g *Getter) CopyOutputData(ctx context.Context, w io.Writer, params *GetterGetParams) error

func (*Getter) Get

func (g *Getter) Get(ctx context.Context, params *GetterGetParams) (*Build, error)

func (*Getter) GetFiles

func (g *Getter) GetFiles(ctx context.Context, params *GetterGetParams) ([]*File, error)

type GetterGetParams

type GetterGetParams struct {
	ID     uuid.UUID
	UserID uuid.UUID
}

type Status

type Status string
const (
	StatusTodo  Status = "todo"
	StatusDoing Status = "doing"
	StatusDone  Status = "done"
)

func ParseStatus

func ParseStatus(s string) (status Status, known bool)

Jump to

Keyboard shortcuts

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