domain

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package primitive provides primitive types and functionality for managing application statuses.

Package domain provides domain models and functionality for managing space apps.

Index

Constants

This section is empty.

Variables

View Source
var (
	// AppStatusInit represents the application status when it is in the initialization phase.
	AppStatusInit = appStatus(appInit)

	// AppStatusServing represents the application status when it is serving requests.
	AppStatusServing = appStatus(serving)

	// AppStatusBuilding represents the application status when it is being built.
	AppStatusBuilding = appStatus(building)

	// AppStatusBuildFailed represents the application status when the build process fails.
	AppStatusBuildFailed = appStatus(buildFailed)

	// AppStatusStartFailed represents the application status when the start process fails.
	AppStatusStartFailed = appStatus(startFailed)

	// AppStatusServeStarting represents the application status when the build process is successful.
	AppStatusServeStarting = appStatus(starting)

	// AppStatusRestarted represents the application status when the app is restarted.
	AppStatusRestarted = appStatus(restarting)

	// AppStatusRestartFailed represents the application status when the app is restart failed.
	AppStatusRestartFailed = appStatus(restartFailed)

	// AppStatusPaused represents the application status when the app is pause.
	AppStatusPaused = appStatus(paused)

	// AppStatusResuming represents the application status when the app is resume.
	AppStatusResuming = appStatus(resuming)

	// AppStatusResumeFailed represents the application status when the app is resume failed.
	AppStatusResumeFailed = appStatus(resumeFailed)

	// AppStatusSleeping represents the application status when the app is sleeping.
	AppStatusSleeping = appStatus(sleeping)
)

Functions

This section is empty.

Types

type AppStatus added in v1.5.0

type AppStatus interface {
	IsInit() bool
	AppStatus() string
	IsBuilding() bool
	IsStarting() bool
	IsRestarting() bool
	IsRestartFailed() bool
	IsPaused() bool
	IsResuming() bool
	IsResumeFailed() bool
	IsUpdateStatusAccept() bool
	IsStartFailed() bool
	IsServing() bool
	IsSleeping() bool
}

AppStatus is an interface that defines methods for working with application statuses.

func CreateAppStatus added in v1.5.0

func CreateAppStatus(v string) AppStatus

CreateAppStatus creates a new instance of AppStatus with the provided value.

func NewAppStatus added in v1.5.0

func NewAppStatus(v string) (AppStatus, error)

NewAppStatus creates a new instance of AppStatus based on the provided value.

type AppURL added in v1.5.0

type AppURL interface {
	AppURL() string
}

AppURL is an interface for app url operations.

func CreateAppURL added in v1.5.0

func CreateAppURL(v string) AppURL

CreateAppURL creates a new app URL instance with the given value without validation.

func NewAppURL added in v1.5.0

func NewAppURL(v string) (AppURL, error)

NewAppURL creates a new app URL instance with the given value.

type Inference

type Inference struct {
	InferenceInfo

	// following fields is not under the controlling of version
	InferenceDetail
}

type InferenceDetail

type InferenceDetail struct {
	// Expiry stores the time when the inference instance will exit.
	Expiry int64

	// Error stores the message when the reference instance starts failed
	Error string

	// AccessURL stores the url to access the inference service.
	AccessURL string
}

type InferenceIndex

type InferenceIndex struct {
	Project    dp.ResourceIndex
	Id         string
	LastCommit string
}

type InferenceInfo

type InferenceInfo struct {
	InferenceIndex

	ProjectName   dp.ResourceName
	ResourceLevel string
	Requester     string
}

type SeverSentEvent added in v1.5.0

type SeverSentEvent interface {
	Request(*SeverSentStream) error
}

SeverSentEvent represents a server-sent event.

type SeverSentStream added in v1.5.0

type SeverSentStream struct {
	Parameter   StreamParameter
	Ctx         context.Context
	StreamWrite func(doOnce func() ([]byte, error))
}

SeverSentStream represents a server-sent stream.

type SpaceApp added in v1.5.0

type SpaceApp struct {
	Id domain.Identity

	SpaceAppIndex

	Status AppStatus
	Reason string

	ResumedAt   int64
	RestartedAt int64

	AppURL      AppURL
	AppLogURL   domain.URL
	BuildLogURL domain.URL

	Version int
}

SpaceApp represents a space app.

func (*SpaceApp) GetFailedReason added in v1.5.0

func (app *SpaceApp) GetFailedReason() string

GetFailedReason app only return failed reason

func (*SpaceApp) IsAppNotAllowToInit added in v1.5.0

func (app *SpaceApp) IsAppNotAllowToInit() bool

IsAppNotAllowToInit app can be init if return false

func (*SpaceApp) SetBuildFailed added in v1.5.0

func (app *SpaceApp) SetBuildFailed(status AppStatus, reason string) error

SetBuildFailed set app status is build failed.

func (*SpaceApp) SetStartFailed added in v1.5.0

func (app *SpaceApp) SetStartFailed(status AppStatus, reason string) error

SetStartFailed set app status is start failed.

func (*SpaceApp) SetStarting added in v1.5.0

func (app *SpaceApp) SetStarting() error

SetStarting sets the starting status of the space app based on the success parameter.

func (*SpaceApp) StartBuilding added in v1.5.0

func (app *SpaceApp) StartBuilding(logURL domain.URL) error

StartBuilding starts the building process for the space app and sets the build log URL.

func (*SpaceApp) StartServing added in v1.5.0

func (app *SpaceApp) StartServing(appURL AppURL, logURL domain.URL) error

StartServing starts the service for the space app with the specified app URL and log URL.

type SpaceAppBuildLog added in v1.5.0

type SpaceAppBuildLog struct {
	AppId domain.Identity
	Logs  string
}

SpaceAppBuildLog is the value object of log

type SpaceAppCreateEvent added in v1.5.0

type SpaceAppCreateEvent struct {
	Id       string `json:"space_id"`
	CommitId string `json:"commit_id"`
}

type SpaceAppIndex added in v1.5.0

type SpaceAppIndex struct {
	SpaceId  domain.Identity
	CommitId string
}

SpaceAppIndex represents the index for a space app.

type StreamParameter added in v1.5.0

type StreamParameter struct {
	StreamUrl string `json:"stream_url" required:"true"`
}

StreamParameter is a type alias for StreamParameter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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