@@ -14,6 +14,7 @@ import {
14
14
} from "../../../codec/index.js" ;
15
15
import {
16
16
CursorLocationType ,
17
+ type ITreeCursorSynchronous ,
17
18
type SchemaAndPolicy ,
18
19
type TreeChunk ,
19
20
} from "../../../core/index.js" ;
@@ -34,32 +35,36 @@ export const ChunkReferenceId = Type.Number({ multipleOf: 1, minimum: 0 });
34
35
export type ChunkReferenceId = Static < typeof ChunkReferenceId > ;
35
36
36
37
/**
37
- * Properties for encoding a chunk that supports incremental encoding.
38
- * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalChunk `.
38
+ * Properties for incremental encoding.
39
+ * Fields that support incremental encoding will encode their chunks separately by calling `encodeIncrementalField `.
39
40
* This supports features like incremental summarization where the summary from these fields can be re-used if
40
41
* unchanged between summaries.
41
42
* Note that each of these chunks that are incrementally encoded is fully self-describing (contain its own shapes
42
43
* list and identifier table) and does not rely on context from its parent.
43
44
*/
44
45
export interface IncrementalEncoder {
45
46
/**
46
- * Called to encode an incremental chunk which are encoded separately from the main buffer.
47
- * @param chunk - The chunk to encode.
48
- * @param chunkEncoder - A function that encodes the chunk's contents.
49
- * @returns The reference ID of the encoded chunk. This is used to retrieve the encoded chunk later.
47
+ * Called to encode an incremental field at the cursor. The chunks for this field are encoded separately
48
+ * from the main buffer.
49
+ * @param cursor - The cursor pointing to the field to encode.
50
+ * @param chunkEncoder - A function that encodes the contents of the passed chunk in the field.
51
+ * @returns The reference IDs of the encoded chunks in the field. This is used to retrieve the encoded
52
+ * chunks later.
50
53
*/
51
- encodeIncrementalChunk (
52
- chunk : TreeChunk ,
53
- chunkEncoder : ( ) => EncodedFieldBatch ,
54
- ) : ChunkReferenceId ;
54
+ encodeIncrementalField (
55
+ cursor : ITreeCursorSynchronous ,
56
+ chunkEncoder : ( chunk : TreeChunk ) => EncodedFieldBatch ,
57
+ ) : ChunkReferenceId [ ] ;
55
58
}
56
59
57
60
/**
58
- * Properties for decoding a chunk that supports incremental encoding. See {@link IncrementalEncoder} for more details.
61
+ * Properties for incremental decoding.
62
+ * Fields that had their chunks incrementally encoded will retrieve these chunks by calling
63
+ * `getEncodedIncrementalChunk`. See {@link IncrementalEncoder} for more details.
59
64
*/
60
65
export interface IncrementalDecoder {
61
66
/**
62
- * Called to get the encoded contents of an incremental chunk with the given reference ID.
67
+ * Called to get the encoded contents of an chunk in an incremental field with the given reference ID.
63
68
* @param referenceId - The reference ID of the chunk to retrieve.
64
69
* @returns The encoded contents of the chunk.
65
70
*/
@@ -73,7 +78,7 @@ export interface FieldBatchEncodingContext {
73
78
readonly originatorId : SessionId ;
74
79
readonly schema ?: SchemaAndPolicy ;
75
80
/**
76
- * An encoder / decoder for encoding and decoding of incremental chunks . This will be defined if
81
+ * An encoder / decoder for encoding and decoding of incremental fields . This will be defined if
77
82
* incremental encoding is supported and enabled.
78
83
*/
79
84
readonly incrementalEncoderDecoder ?: IncrementalEncoderDecoder ;
0 commit comments