@sailboat-computer/resilience
Version:
Enhanced resilience patterns for sailboat computer v3 with marine-specific adaptations
92 lines • 2.54 kB
TypeScript
/**
* Types for the resilience framework
*/
export * from './marine-constants';
import { common } from '@sailboat-computer/sailboat-types';
export type HealthStatusType = common.HealthStatus;
export type OperationalContextType = common.OperationalContext;
export type MarineFailureTypeType = common.MarineFailureType;
export type CircuitBreakerStateType = common.CircuitBreakerState;
export type MarineSystemTypeType = common.MarineSystemType;
/**
* Circuit breaker configuration
*/
export interface CircuitBreakerConfig {
failureThreshold: number;
successThreshold: number;
timeout: number;
operationalContext: OperationalContextType;
failureTypes: MarineFailureTypeType[];
environmentalAdjustments: {
roughSeas: boolean;
lowPower: boolean;
limitedConnectivity: boolean;
};
volumeThreshold: number;
errorPercentageThreshold: number;
slowCallDurationThreshold: number;
slowCallRateThreshold: number;
}
/**
* Retry configuration
*/
export interface RetryConfig {
maxAttempts: number;
initialDelayMs: number;
maxDelayMs: number;
backoffStrategy: 'linear' | 'exponential' | 'fibonacci' | 'random';
backoffFactor: number;
operationalContext: OperationalContextType;
failureTypes: MarineFailureTypeType[];
environmentalAdjustments: {
roughSeas: boolean;
lowPower: boolean;
limitedConnectivity: boolean;
};
}
/**
* Timeout configuration
*/
export interface TimeoutConfig {
timeoutMs: number;
operationalContext: OperationalContextType;
environmentalAdjustments: {
roughSeas: boolean;
lowPower: boolean;
limitedConnectivity: boolean;
};
cancelOnTimeout: boolean;
timeoutStrategy: 'fixed' | 'adaptive';
}
/**
* Bulkhead configuration
*/
export interface BulkheadConfig {
maxConcurrent: number;
maxQueueSize: number;
operationalContext: OperationalContextType;
environmentalAdjustments: {
roughSeas: boolean;
lowPower: boolean;
limitedConnectivity: boolean;
};
fairQueue: boolean;
queueTimeout: number;
}
/**
* Degradation configuration
*/
export interface DegradationConfig {
degradationLevels: {
level: number;
threshold: number;
features: string[];
}[];
operationalContext: OperationalContextType;
environmentalAdjustments: {
roughSeas: boolean;
lowPower: boolean;
limitedConnectivity: boolean;
};
}
//# sourceMappingURL=index.d.ts.map