File size: 5,738 Bytes
78c921d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import * as flatbuffers from 'flatbuffers';
import { Schema as _Schema } from '../../fb/schema.js';
import { RecordBatch as _RecordBatch } from '../../fb/record-batch.js';
import { DictionaryBatch as _DictionaryBatch } from '../../fb/dictionary-batch.js';
import { Buffer as _Buffer } from '../../fb/buffer.js';
import { Field as _Field } from '../../fb/field.js';
import { FieldNode as _FieldNode } from '../../fb/field-node.js';
import { Schema, Field } from '../../schema.js';
import { ArrayBufferViewInput } from '../../util/buffer.js';
import { MessageHeader, MetadataVersion } from '../../enum.js';
import { fieldFromJSON, schemaFromJSON, recordBatchFromJSON, dictionaryBatchFromJSON } from './json.js';
import Long = flatbuffers.Long;
import Builder = flatbuffers.Builder;
import { DataType } from '../../type.js';
/**
 * @ignore
 * @private
 **/
export declare class Message<T extends MessageHeader = any> {
    /** @nocollapse */
    static fromJSON<T extends MessageHeader>(msg: any, headerType: T): Message<T>;
    /** @nocollapse */
    static decode(buf: ArrayBufferViewInput): Message<MessageHeader>;
    /** @nocollapse */
    static encode<T extends MessageHeader>(message: Message<T>): Uint8Array;
    /** @nocollapse */
    static from(header: Schema | RecordBatch | DictionaryBatch, bodyLength?: number): Message<MessageHeader.Schema> | Message<MessageHeader.RecordBatch> | Message<MessageHeader.DictionaryBatch>;
    body: Uint8Array;
    protected _headerType: T;
    protected _bodyLength: number;
    protected _version: MetadataVersion;
    get type(): T;
    get version(): MetadataVersion;
    get headerType(): T;
    get bodyLength(): number;
    protected _createHeader: MessageHeaderDecoder;
    header(): T extends MessageHeader.Schema ? Schema<any> : T extends MessageHeader.RecordBatch ? RecordBatch : T extends MessageHeader.DictionaryBatch ? DictionaryBatch : never;
    isSchema(): this is Message<MessageHeader.Schema>;
    isRecordBatch(): this is Message<MessageHeader.RecordBatch>;
    isDictionaryBatch(): this is Message<MessageHeader.DictionaryBatch>;
    constructor(bodyLength: Long | number, version: MetadataVersion, headerType: T, header?: any);
}
/**
 * @ignore
 * @private
 **/
export declare class RecordBatch {
    protected _length: number;
    protected _nodes: FieldNode[];
    protected _buffers: BufferRegion[];
    get nodes(): FieldNode[];
    get length(): number;
    get buffers(): BufferRegion[];
    constructor(length: Long | number, nodes: FieldNode[], buffers: BufferRegion[]);
}
/**
 * @ignore
 * @private
 **/
export declare class DictionaryBatch {
    protected _id: number;
    protected _isDelta: boolean;
    protected _data: RecordBatch;
    get id(): number;
    get data(): RecordBatch;
    get isDelta(): boolean;
    get length(): number;
    get nodes(): FieldNode[];
    get buffers(): BufferRegion[];
    constructor(data: RecordBatch, id: Long | number, isDelta?: boolean);
}
/**
 * @ignore
 * @private
 **/
export declare class BufferRegion {
    offset: number;
    length: number;
    constructor(offset: Long | number, length: Long | number);
}
/**
 * @ignore
 * @private
 **/
export declare class FieldNode {
    length: number;
    nullCount: number;
    constructor(length: Long | number, nullCount: Long | number);
}
declare module '../../schema' {
    namespace Field {
        export { encodeField as encode };
        export { decodeField as decode };
        export { fieldFromJSON as fromJSON };
    }
    namespace Schema {
        export { encodeSchema as encode };
        export { decodeSchema as decode };
        export { schemaFromJSON as fromJSON };
    }
}
declare module './message' {
    namespace RecordBatch {
        export { encodeRecordBatch as encode };
        export { decodeRecordBatch as decode };
        export { recordBatchFromJSON as fromJSON };
    }
    namespace DictionaryBatch {
        export { encodeDictionaryBatch as encode };
        export { decodeDictionaryBatch as decode };
        export { dictionaryBatchFromJSON as fromJSON };
    }
    namespace FieldNode {
        export { encodeFieldNode as encode };
        export { decodeFieldNode as decode };
    }
    namespace BufferRegion {
        export { encodeBufferRegion as encode };
        export { decodeBufferRegion as decode };
    }
}
/** @ignore */
declare function decodeSchema(_schema: _Schema, dictionaries?: Map<number, DataType>): Schema<any>;
/** @ignore */
declare function decodeRecordBatch(batch: _RecordBatch, version?: MetadataVersion): RecordBatch;
/** @ignore */
declare function decodeDictionaryBatch(batch: _DictionaryBatch, version?: MetadataVersion): DictionaryBatch;
/** @ignore */
declare function decodeBufferRegion(b: _Buffer): BufferRegion;
/** @ignore */
declare function decodeFieldNode(f: _FieldNode): FieldNode;
/** @ignore */
declare function decodeField(f: _Field, dictionaries?: Map<number, DataType>): Field<any>;
/** @ignore */
declare function encodeSchema(b: Builder, schema: Schema): number;
/** @ignore */
declare function encodeField(b: Builder, field: Field): number;
/** @ignore */
declare function encodeRecordBatch(b: Builder, recordBatch: RecordBatch): number;
/** @ignore */
declare function encodeDictionaryBatch(b: Builder, dictionaryBatch: DictionaryBatch): number;
/** @ignore */
declare function encodeFieldNode(b: Builder, node: FieldNode): number;
/** @ignore */
declare function encodeBufferRegion(b: Builder, node: BufferRegion): number;
/** @ignore */
declare type MessageHeaderDecoder = <T extends MessageHeader>() => T extends MessageHeader.Schema ? Schema : T extends MessageHeader.RecordBatch ? RecordBatch : T extends MessageHeader.DictionaryBatch ? DictionaryBatch : never;
export {};