xdrive.ts 1.2 KB

1234567891011121314151617181920212223242526
  1. import { z } from 'zod';
  2. // XDRIVE tunnels the stream through files in shared cloud storage, so both ends
  3. // carry the same service, folder and secrets. Zero/absent tuning knobs take the
  4. // core's defaults; segmentBytes and concurrency are capped there at 16 MiB / 64.
  5. export const XDriveServiceSchema = z.enum(['Google Drive', 'local', 'template']);
  6. export type XDriveService = z.infer<typeof XDriveServiceSchema>;
  7. const MillisSchema = z.number().int().min(0);
  8. export const XDriveStreamSettingsSchema = z.object({
  9. service: XDriveServiceSchema.default('Google Drive'),
  10. remoteFolder: z.string().default(''),
  11. // Google Drive takes exactly three, in order: ClientID, ClientSecret, RefreshToken.
  12. secrets: z.array(z.string()).default([]),
  13. segmentBytes: z.number().int().min(0).optional(),
  14. flushIntervalMs: MillisSchema.optional(),
  15. pollIntervalMs: MillisSchema.optional(),
  16. maxPollIntervalMs: MillisSchema.optional(),
  17. sessionTtlSeconds: z.number().int().min(0).optional(),
  18. concurrency: z.number().int().min(0).optional(),
  19. eagerWindowMs: MillisSchema.optional(),
  20. holeTimeoutMs: MillisSchema.optional(),
  21. template: z.record(z.string(), z.unknown()).optional(),
  22. });
  23. export type XDriveStreamSettings = z.infer<typeof XDriveStreamSettingsSchema>;