UNPKG

@fluent-org/logger

Version:
62 lines (61 loc) 2.3 kB
import { PacketData, Queue } from "./queue"; import * as protocol from "../protocol"; import { DeferredPromise } from "../util"; declare type PackedRecord = { tag: protocol.Tag; entries: Uint8Array[]; /** * The total length of the buffers in entries * * Useful for concatenating them all together later */ size: number; deferred: DeferredPromise<void>; }; /** * Implements the Forward specification's [(Compressed)?PackedForward mode](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#packedforward-mode) * * Implements both in the same queue, because the only code difference is compression in `nextPacket`. * * Subclassed below into the correct modes. */ declare class BasePackedForwardQueue extends Queue { /** * Maintain the queue as a Map * * JS guarantees maps are insertion ordered, so calling sendQueue.values().next.value will be the first tag to be inserted. */ private sendQueue; /** * The total size of the buffers in the queue */ private sendQueueSize; /** * The total number of events stored within the queue * * Note that this isn't just sendQueue.size because each entry in the map can have multiple events */ private sendQueueLength; /** * Used to gate compression of `nextPacket`. The difference between PackedForward and CompressedPackedForward */ protected compressed: boolean; get queueSize(): number; get queueLength(): number; push(tag: protocol.Tag, time: protocol.Time, data: protocol.EventRecord): Promise<void>; protected pop(): PackedRecord | null; nextPacket(chunk?: protocol.Chunk): PacketData | null; } /** * Implements the Forward specification's [PackedForward mode](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#packedforward-mode) */ export declare class PackedForwardQueue extends BasePackedForwardQueue { protected compressed: boolean; } /** * Implements the Forward specification's [CompressedPackedForward mode](https://github.com/fluent/fluentd/wiki/Forward-Protocol-Specification-v1#compressedpackedforward-mode) */ export declare class CompressedPackedForwardQueue extends BasePackedForwardQueue { protected compressed: boolean; } export {};