import { throwOutput, } from "../ivm/operator.js";
export class MeasurePushOperator {
    #input;
    #queryID;
    #metricsDelegate;
    #output = throwOutput;
    #metricName;
    constructor(input, queryID, metricsDelegate, metricName) {
        this.#input = input;
        this.#queryID = queryID;
        this.#metricsDelegate = metricsDelegate;
        this.#metricName = metricName;
        input.setOutput(this);
    }
    setOutput(output) {
        this.#output = output;
    }
    fetch(req) {
        return this.#input.fetch(req);
    }
    cleanup(req) {
        return this.#input.cleanup(req);
    }
    getSchema() {
        return this.#input.getSchema();
    }
    destroy() {
        this.#input.destroy();
    }
    push(change) {
        const startTime = performance.now();
        this.#output.push(change, this);
        this.#metricsDelegate.addMetric(this.#metricName, performance.now() - startTime, this.#queryID);
    }
}
//# sourceMappingURL=measure-push-operator.js.map