booking

package
v0.0.0-...-f4b0cf5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Booking

type Booking struct {
	utils.AbstractObject                        // AbstractObject contains the basic fields of an object (id, name)
	PricedItem           map[string]interface{} `json:"priced_item,omitempty" bson:"priced_item,omitempty"` // We need to add the validate:"required" tag once the pricing feature is implemented, removed to avoid handling the error

	ResumeMetrics    map[string]map[string]models.MetricResume `json:"resume_metrics,omitempty" bson:"resume_metrics,omitempty"`
	ExecutionMetrics map[string][]models.MetricsSnapshot       `json:"metrics,omitempty" bson:"metrics,omitempty"`

	ExecutionsID      string             `json:"executions_id,omitempty" bson:"executions_id,omitempty" validate:"required"` // ExecutionsID is the ID of the executions
	DestPeerID        string             `json:"dest_peer_id,omitempty" bson:"dest_peer_id,omitempty"`                       // DestPeerID is the ID of the destination peer
	WorkflowID        string             `json:"workflow_id,omitempty" bson:"workflow_id,omitempty"`                         // WorkflowID is the ID of the workflow
	ExecutionID       string             `json:"execution_id,omitempty" bson:"execution_id,omitempty" validate:"required"`
	State             enum.BookingStatus `json:"state,omitempty" bson:"state,omitempty" validate:"required"`                             // State is the state of the booking
	ExpectedStartDate time.Time          `json:"expected_start_date,omitempty" bson:"expected_start_date,omitempty" validate:"required"` // ExpectedStartDate is the expected start date of the booking
	ExpectedEndDate   *time.Time         `json:"expected_end_date,omitempty" bson:"expected_end_date,omitempty" validate:"required"`     // ExpectedEndDate is the expected end date of the booking

	RealStartDate *time.Time `json:"real_start_date,omitempty" bson:"real_start_date,omitempty"` // RealStartDate is the real start date of the booking
	RealEndDate   *time.Time `json:"real_end_date,omitempty" bson:"real_end_date,omitempty"`     // RealEndDate is the real end date of the booking

	ResourceType tools.DataType `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"` // ResourceType is the type of the resource
	ResourceID   string         `json:"resource_id,omitempty" bson:"resource_id,omitempty" validate:"required"`     // could be a Compute or a Storage
}

* Booking is a struct that represents a booking

func (*Booking) CalcDeltaOfExecution

func (b *Booking) CalcDeltaOfExecution() map[string]map[string]models.MetricResume

func (*Booking) CanDelete

func (r *Booking) CanDelete() bool

func (*Booking) CanUpdate

func (r *Booking) CanUpdate(set utils.DBObject) (bool, utils.DBObject)

func (*Booking) Check

func (wfa *Booking) Check(id string, start time.Time, end *time.Time, parrallelAllowed int) (bool, error)

CheckBooking checks if a booking is possible on a specific compute resource

func (*Booking) GetAccessor

func (d *Booking) GetAccessor(request *tools.APIRequest) utils.Accessor

func (*Booking) GetDelayForFinishing

func (d *Booking) GetDelayForFinishing() time.Duration

func (*Booking) GetDelayForLaunch

func (d *Booking) GetDelayForLaunch() time.Duration

func (*Booking) GetDelayOnDuration

func (d *Booking) GetDelayOnDuration() time.Duration

func (*Booking) GetRealDuration

func (d *Booking) GetRealDuration() time.Duration

func (*Booking) GetUsualDuration

func (d *Booking) GetUsualDuration() time.Duration

func (*Booking) StoreDraftDefault

func (r *Booking) StoreDraftDefault()

func (*Booking) VerifyAuth

func (d *Booking) VerifyAuth(request *tools.APIRequest) bool

type BookingMongoAccessor

type BookingMongoAccessor struct {
	utils.AbstractAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
}

func NewAccessor

func NewAccessor(request *tools.APIRequest) *BookingMongoAccessor

New creates a new instance of the BookingMongoAccessor

func (*BookingMongoAccessor) CopyOne

func (a *BookingMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error)

func (*BookingMongoAccessor) DeleteOne

func (a *BookingMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error)

* Nothing special here, just the basic CRUD operations

func (*BookingMongoAccessor) LoadAll

func (a *BookingMongoAccessor) LoadAll(isDraft bool) ([]utils.ShallowDBObject, int, error)

func (*BookingMongoAccessor) LoadOne

func (a *BookingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error)

func (*BookingMongoAccessor) Search

func (a *BookingMongoAccessor) Search(filters *dbs.Filters, search string, isDraft bool) ([]utils.ShallowDBObject, int, error)

func (*BookingMongoAccessor) StoreOne

func (a *BookingMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error)

func (*BookingMongoAccessor) UpdateOne

func (a *BookingMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error)

Jump to

Keyboard shortcuts

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