Documentation
¶
Index ¶
- Constants
- func DrainAndCloseResponseBody(resp *http.Response)
- func DrainAndCloseResponseBodyAndCancelContext(resp *http.Response, ctxCancel context.CancelFunc)
- type ComponentIDs
- type Counts
- type FailureResponse
- type Key
- type Problem7807
- type Production
- func (i *Production) Aquire(xnames []string) error
- func (i *Production) Check(xnames []string) bool
- func (i *Production) FlexAquire(xnames []string) (ReservationCreateResponse, error)
- func (i *Production) FlexCheck(xnames []string) (ReservationCreateResponse, bool)
- func (i *Production) FlexRelease(xnames []string) (ReservationReleaseRenewResponse, error)
- func (i *Production) Init(stateManagerServer string, reservationPath string, defaultTermMinutes int, ...)
- func (i *Production) InitInstance(stateManagerServer string, reservationPath string, defaultTermMinutes int, ...)
- func (i *Production) Reacquire(reservations []Reservation, flex bool) (ReservationReleaseRenewResponse, error)
- func (i *Production) Release(xnames []string) error
- func (i *Production) Status() (res map[string]Reservation)
- func (i *Production) ValidateDeputyKeys(keys []Key) (ReservationCheckResponse, error)
- type Reservation
- type ReservationCheckParameters
- type ReservationCheckResponse
- type ReservationCheckSuccessResponse
- type ReservationCreateParameters
- type ReservationCreateResponse
- type ReservationCreateSuccessResponse
- type ReservationReleaseParameters
- type ReservationReleaseRenewResponse
- type ReservationRenewalParameters
- type ServiceReservation
Constants ¶
const ( CLProcessingModelRigid = "rigid" CLProcessingModelFlex = "flexible" )
const DEFAULT_TERM_MINUTES = 1
const DefaultExpirationWindow = 30
const DefaultSleepTime = 10
const HSM_DEFAULT_RESERVATION_PATH = "/hsm/v2/locks/service/reservations"
const HSM_DEFAULT_SERVER = "https://api-gw-service-nmn/apis/smd"
Variables ¶
This section is empty.
Functions ¶
func DrainAndCloseResponseBody ¶ added in v2.11.18
Response bodies should always be drained and closed, else we leak resources and fail to reuse network connections. TODO: This should be moved into hms-base
func DrainAndCloseResponseBodyAndCancelContext ¶ added in v2.11.18
func DrainAndCloseResponseBodyAndCancelContext(resp *http.Response, ctxCancel context.CancelFunc)
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 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 ¶
func (i *Production) FlexAquire(xnames []string) (ReservationCreateResponse, error)
func (*Production) FlexCheck ¶
func (i *Production) FlexCheck(xnames []string) (ReservationCreateResponse, bool)
func (*Production) FlexRelease ¶
func (i *Production) FlexRelease(xnames []string) (ReservationReleaseRenewResponse, error)
func (*Production) InitInstance ¶
func (*Production) Reacquire ¶ added in v2.4.0
func (i *Production) Reacquire(reservations []Reservation, flex bool) (ReservationReleaseRenewResponse, error)
Restarts periodic renew for already owned reservations
func (*Production) Release ¶
func (i *Production) Release(xnames []string) error
func (*Production) Status ¶
func (i *Production) Status() (res map[string]Reservation)
func (*Production) ValidateDeputyKeys ¶
func (i *Production) ValidateDeputyKeys(keys []Key) (ReservationCheckResponse, error)
type Reservation ¶
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 ReservationReleaseRenewResponse ¶
type ReservationReleaseRenewResponse struct { Counts Counts `json:"Counts"` Success ComponentIDs `json:"Success"` Failure []FailureResponse `json:"Failure"` }
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) //Restarts periodic renew for already owned reservations Reacquire(reservationKeys []Key, flex bool) (ReservationReleaseRenewResponse, 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