Skip to main content

New

Initializes and returns a new Manager instance, configuring it with the provided cache configuration, output repository, and reservation repository. It sets default values for the maximum reservation heartbeat interval and heartbeat grace period multiplier if they are not specified or are invalid in the configuration.

def New(
cfg: *cacheconfig.Config,
outputs: interfaces.CachedOutputRepo,
reservations: interfaces.ReservationRepo
) - > *Manager

Initializes and returns a new Manager instance, configuring its reservation heartbeat and grace period settings based on the provided configuration. This function ensures that the heartbeat interval and grace period multiplier have valid positive values, applying defaults if necessary.

Parameters

NameTypeDescription
cfg*cacheconfig.ConfigThe configuration object containing settings for the cache manager, including MaxReservationHeartbeat and HeartbeatGracePeriodMultiplier.
outputsinterfaces.CachedOutputRepoThe repository for managing cached outputs, used by the Manager to interact with stored data.
reservationsinterfaces.ReservationRepoThe repository for managing reservations, used by the Manager to handle resource reservation logic.

Returns

TypeDescription
*ManagerA new Manager instance configured with the specified or default heartbeat and grace period settings.