mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-20 16:07:11 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import type { RunDispatchLeaseRecord } from '../domain/runDispatchLease';
|
||||
import type { ReleaseRunDispatchLeaseResult } from '../ports/runDispatchLeaseRepository';
|
||||
import type { WorkerRunLeaseClient } from '../ports/workerRunLeaseClient';
|
||||
import type {
|
||||
FencedRunDispatchLeaseRequest,
|
||||
ReleaseRunDispatchLeaseRequest,
|
||||
} from './runDispatchLeaseService';
|
||||
import { RunDispatchLeaseService } from './runDispatchLeaseService';
|
||||
import type { AuthenticatedWorkerPrincipal } from './workerControlService';
|
||||
|
||||
/**
|
||||
* Transport seam: the authenticated principal is fixed when the client is
|
||||
* constructed and can never be supplied by a Worker request body.
|
||||
*/
|
||||
export class BoundWorkerRunLeaseClient implements WorkerRunLeaseClient {
|
||||
constructor(
|
||||
private readonly service: RunDispatchLeaseService,
|
||||
private readonly principal: AuthenticatedWorkerPrincipal,
|
||||
) {}
|
||||
|
||||
renew(
|
||||
request: FencedRunDispatchLeaseRequest,
|
||||
): Promise<RunDispatchLeaseRecord> {
|
||||
return this.service.renew(this.principal, request);
|
||||
}
|
||||
|
||||
release(
|
||||
request: ReleaseRunDispatchLeaseRequest,
|
||||
): Promise<ReleaseRunDispatchLeaseResult> {
|
||||
return this.service.release(this.principal, request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user