booking

package
v0.0.0-...-0e0540a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccessor

func NewAccessor(request *tools.APIRequest) *bookingMongoAccessor

New creates a new instance of the bookingMongoAccessor

Types

type Booking

type Booking struct {
	utils.AbstractObject                      // AbstractObject contains the basic fields of an object (id, name)
	DestPeerID           string               `json:"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                common.ScheduledType `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) 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) GetName

func (d *Booking) GetName() string

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

Jump to

Keyboard shortcuts

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