service_reservations

package
v1.62.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLProcessingModelRigid = "rigid"
	CLProcessingModelFlex  = "flexible"
)
View Source
const DEFAULT_TERM_MINUTES = 1
View Source
const DefaultExpirationWindow = 30
View Source
const DefaultSleepTime = 10
View Source
const HSM_DEFAULT_RESERVATION_PATH = "/hsm/v2/locks/service/reservations"
View Source
const HSM_DEFAULT_SERVER = "https://api-gw-service-nmn/apis/smd"

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentIDs

type ComponentIDs struct {
	ComponentIDs []string `json:"ComponentIDs"`
}

type Counts

type Counts struct {
	Total   int `json:"Total"`
	Success int `json:"Success"`
	Failure int `json:"Failure"`
}

Renew/Release ServRes, Release/Remove Res, Create/Unlock/Repair/Disable locks

type FailureResponse

type FailureResponse struct {
	ID     string `json:"ID"`
	Reason string `json:"Reason"`
}

type Key

type Key struct {
	ID  string `json:"ID"`
	Key string `json:"Key"`
}

Release Res, Release/Renew ServRes

type Problem7807

type Problem7807 struct {
	Type_    string `json:"type"`
	Detail   string `json:"detail,omitempty"`
	Instance string `json:"instance,omitempty"`
	Status   int    `json:"status,omitempty"`
	Title    string `json:"title,omitempty"`
}

RFC 7807 compliant error payload. All fields are optional except the 'type' field.

type Production

type Production struct {
	// contains filtered or unexported fields
}

func (*Production) Aquire

func (i *Production) Aquire(xnames []string) error

func (*Production) Check

func (i *Production) Check(xnames []string) bool

func (*Production) FlexAquire added in v1.47.0

func (i *Production) FlexAquire(xnames []string) (ReservationCreateResponse, error)

func (*Production) FlexCheck added in v1.47.0

func (i *Production) FlexCheck(xnames []string) (ReservationCreateResponse, bool)

func (*Production) FlexRelease added in v1.47.0

func (i *Production) FlexRelease(xnames []string) (ReservationReleaseRenewResponse, error)

func (*Production) Init

func (i *Production) Init(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger)

func (*Production) InitInstance

func (i *Production) InitInstance(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger, svcName string)

func (*Production) Release

func (i *Production) Release(xnames []string) error

func (*Production) Status

func (i *Production) Status() (res map[string]Reservation)

func (*Production) ValidateDeputyKeys added in v1.44.0

func (i *Production) ValidateDeputyKeys(keys []Key) (ReservationCheckResponse, error)

type Reservation

type Reservation struct {
	Xname          string
	Expiration     time.Time
	DeputyKey      string
	ReservationKey string
}

type ReservationCheckParameters

type ReservationCheckParameters struct {
	DeputyKeys []Key `json:"DeputyKeys"`
}

Check ServRes

type ReservationCheckResponse

type ReservationCheckResponse struct {
	Success []ReservationCheckSuccessResponse `json:"Success"`
	Failure []FailureResponse                 `json:"Failure"`
}

type ReservationCheckSuccessResponse

type ReservationCheckSuccessResponse struct {
	ID             string `json:"ID"`
	DeputyKey      string `json:"DeputyKey"`
	ExpirationTime string `json:"ExpirationTime,omitempty"`
}

Create (Serv)Res

type ReservationCreateParameters

type ReservationCreateParameters struct {
	ID                  []string `json:"ComponentIDs,omitempty"`
	NID                 []string `json:"nid,omitempty"`
	Type                []string `json:"type,omitempty"`
	State               []string `json:"state,omitempty"`
	Flag                []string `json:"flag,omitempty"`
	Enabled             []string `json:"enabled,omitempty"`
	SwStatus            []string `json:"softwarestatus,omitempty"`
	Role                []string `json:"role,omitempty"`
	SubRole             []string `json:"subrole,omitempty"`
	Subtype             []string `json:"subtype,omitempty"`
	Arch                []string `json:"arch,omitempty"`
	Class               []string `json:"class,omitempty"`
	Group               []string `json:"group,omitempty"`
	Partition           []string `json:"partition,omitempty"`
	ProcessingModel     string   `json:"ProcessingModel"`
	ReservationDuration int      `json:"ReservationDuration"`
}

Create/Remove Res, Create ServRes, Check/Lock/Unlock/Repair/Disable Lock

type ReservationCreateResponse

type ReservationCreateResponse struct {
	Success []ReservationCreateSuccessResponse `json:"Success"`
	Failure []FailureResponse                  `json:"Failure"`
}

type ReservationCreateSuccessResponse

type ReservationCreateSuccessResponse struct {
	ID             string `json:"ID"`
	DeputyKey      string `json:"DeputyKey"`
	ReservationKey string `json:"ReservationKey,omitempty"`
	ExpirationTime string `json:"ExpirationTime,omitempty"`
}

Create (Serv)Res

type ReservationReleaseParameters

type ReservationReleaseParameters struct {
	ReservationKeys []Key  `json:"ReservationKeys"`
	ProcessingModel string `json:"ProcessingModel"`
}

type ReservationReleaseRenewResponse

type ReservationReleaseRenewResponse struct {
	Counts  Counts            `json:"Counts"`
	Success ComponentIDs      `json:"Success"`
	Failure []FailureResponse `json:"Failure"`
}

type ReservationRenewalParameters

type ReservationRenewalParameters struct {
	ReservationKeys     []Key  `json:"ReservationKeys"`
	ProcessingModel     string `json:"ProcessingModel"`
	ReservationDuration int    `json:"ReservationDuration"`
}

type ServiceReservation

type ServiceReservation interface {
	Init(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger)

	InitInstance(stateManagerServer string, reservationPath string, defaultTermMinutes int, logger *logrus.Logger, svcName string)

	//Try to aquire locks for a list of xnames, renewing them within 30 seconds of expiration.
	Aquire(xnames []string) error

	//Same as Aquire() will acquire what it can, indicate which succeeded/failed
	FlexAquire(xname []string) (ReservationCreateResponse, error)

	//Validate that I still own the lock for the xnames listed.
	Check(xnames []string) bool

	//Validate which locks I still own from the xnames listed.
	FlexCheck(xnames []string) (ReservationCreateResponse, bool)

	//Validate deputy keys given by another actor
	ValidateDeputyKeys(keys []Key) (ReservationCheckResponse, error)

	//Release the locks on the xnames
	Release(xnames []string) error

	//Release from a list of xnames, only fail on total failure
	FlexRelease(xnames []string) (ReservationReleaseRenewResponse, error)

	Status() map[string]Reservation
}

This uses the rigid implementation, so we will assume for EVERY operation that is all or nothing. This could be pretty easily extended to support the flexible implementation, but this wasnt needed for FAS/CAPMC

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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