signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
63 lines • 2.55 kB
TypeScript
/**
* Per-path retention rules.
*
* The plugin keeps a single global `retentionDays` value (0 = keep
* forever). On top of that, operators can declare a list of overrides:
*
* [{ pattern: 'environment.wind.*', days: 1, skipAggregation: true }]
*
* meaning: any SignalK path matching `environment.wind.*` is kept for
* one day in tier=raw and is NOT aggregated into 5s/60s/1h tiers.
*
* Pattern syntax: glob with `*` matching zero-or-more characters
* (including dots — `environment.wind.*` covers `environment.wind.deep.x`
* too). Other characters are literal.
*
* Resolution: when more than one rule matches a path, the rule with the
* most non-wildcard characters wins (rough proxy for "most specific").
* Ties are broken in declaration order.
*/
export interface PathRetentionRule {
pattern: string;
days: number;
skipAggregation?: boolean;
}
export declare class RetentionRuleSet {
private readonly rules;
/**
* Construct with a list of rules. Per-rule compile failures (from a
* malformed pattern in a hand-edited config) are not fatal — the bad
* rule is dropped and `onCompileError` is invoked so the caller can
* surface it. This keeps a single typo from poisoning plugin start.
*/
constructor(rules?: PathRetentionRule[], onCompileError?: (rule: PathRetentionRule, error: Error) => void);
/**
* Resolve the matching rule for a given SignalK path, or null if none
* matches. The caller decides whether to fall back to the global
* retention default.
*/
match(signalkPath: string): PathRetentionRule | null;
/**
* Resolve effective retention for a path. Falls back to the global
* default when no rule matches. `null` means "keep forever".
*/
resolveRetentionDays(signalkPath: string, globalDefaultDays: number): number | null;
/**
* True if aggregation should skip this path (because a matching rule
* has skipAggregation set).
*/
shouldSkipAggregation(signalkPath: string): boolean;
isEmpty(): boolean;
}
/**
* Validate a list of rules. Always returns the valid rules plus any
* per-entry errors so callers can drop only the bad entries instead of
* all of them. Omitted input (undefined / null) is valid and yields an
* empty rule set; a present-but-non-array input returns `rules: []` with
* one error.
*/
export declare function validatePathRetentionRules(rules: unknown): {
rules: PathRetentionRule[];
errors: string[];
};
//# sourceMappingURL=retention-rules.d.ts.map