pkg

package
v0.0.0-...-ee14de5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCtxCanceled error = status.Error(
		codes.Canceled,
		"ctx: canceled",
	)
	ErrJobNotFound error = status.Error(
		codes.NotFound,
		"job: not found",
	)
	ErrJobExists error = status.Error(
		codes.AlreadyExists,
		"job: exists",
	)
	ErrExtensionNotFound error = status.Error(
		codes.NotFound,
		"extension: not found",
	)
	ErrExtensionExists error = status.Error(
		codes.AlreadyExists,
		"extension: exists",
	)
	ErrExtensionNotSupported error = status.Error(
		codes.InvalidArgument,
		"extension: not supported",
	)
)

Functions

This section is empty.

Types

type Extension

type Extension struct {
	Id       string    `json:"id"`
	Name     string    `json:"name"`
	Metadata *Metadata `json:"metadata"`

	Job      *Job     `json:"job"`
	Provider Provider `json:"-"`
	// contains filtered or unexported fields
}

func NewExtension

func NewExtension(ctx context.Context, name, creator string) *Extension

type ExtensionHandler

type ExtensionHandler interface {
	ServeExtension(w http.ResponseWriter, r *http.Request)
	Register(w http.ResponseWriter, r *http.Request)
}

type ExtensionService

type ExtensionService interface {
	Register(ctx context.Context, name, repositoryUrl, creator string) (*Extension, error)
	Fetch(ctx context.Context, name string) (*Extension, error)
	FetchExtensionViewer(ctx context.Context, e *Extension) (map[string]Viewer, error)
}

type Job

type Job struct {
	Id            string    `json:"id"`
	ExtensionId   string    `json:"extension_id"`
	RepositoryUrl string    `json:"repository_url"`
	Status        JobStatus `json:"status"`
	StatusDetail  string    `json:"status_detail"`
	Metadata      *Metadata `json:"metadata"`
	// contains filtered or unexported fields
}

func NewJob

func NewJob(ctx context.Context, extensionId, repositoryUrl, creator string) *Job

type JobService

type JobService interface {
	Register(ctx context.Context, extensionId, repositoryUrl, creator string) (*Job, error)
	FetchByExtensionId(ctx context.Context, extensionId string) ([]*Job, error)
	PatchStatus(ctx context.Context, id, modifier string, status JobStatus, statusDetail string) error
}

type JobStatus

type JobStatus string
const (
	JobStatusPending    JobStatus = "PENDING"
	JobStatusInProgress JobStatus = "IN_PROGRESS"
	JobStatusCompleted  JobStatus = "COMPLETED"
	JobStatusError      JobStatus = "ERROR"
)

type Metadata

type Metadata struct {
	CreatedAt      time.Time `json:"created_at"`
	CreatedBy      string    `json:"created_by"`
	LastModifiedAt time.Time `json:"last_modified_at"`
	LastModifiedBy string    `json:"last_modified_by"`
	IsActive       bool      `json:"is_active"`
	// contains filtered or unexported fields
}

func NewMetadata

func NewMetadata(ctx context.Context, creator string) *Metadata

func (*Metadata) Delete

func (m *Metadata) Delete(ctx context.Context, modifier string)

func (*Metadata) Update

func (m *Metadata) Update(ctx context.Context, modifier string)

type Provider

type Provider interface {
	Provide(context.Context, string) (map[string]Viewer, error)
}

func ProviderFrom

func ProviderFrom(_ context.Context, sym plugin.Symbol) (Provider, error)

type ProviderFunc

type ProviderFunc func(context.Context, string) (map[string]Viewer, error)

func (ProviderFunc) Provide

func (p ProviderFunc) Provide(ctx context.Context, name string) (map[string]Viewer, error)

type Viewer

type Viewer interface {
	View(context.Context) http.Handler
}

type ViewerFunc

type ViewerFunc func(context.Context) http.Handler

func (ViewerFunc) View

func (v ViewerFunc) View(ctx context.Context) http.Handler

Jump to

Keyboard shortcuts

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