@phroun/paged-buffer
Version:
High-performance buffer system for editing massive files with intelligent memory management and undo/redo capabilities
84 lines • 2.75 kB
TypeScript
/**
* Enhanced Page metadata with simplified line tracking and no marks management
* (Marks are now handled globally by the page coordinate system)
*/
export class PageInfo {
/**
* Calculate fast checksum for change detection
* @param {Buffer} data - Data to checksum
* @returns {string} - Checksum
*/
static calculateChecksum(data: Buffer): string;
constructor(pageId: any, fileOffset: any, originalSize: any, checksum?: null);
pageId: any;
fileOffset: any;
originalSize: any;
checksum: any;
isDirty: boolean;
isLoaded: boolean;
isDetached: boolean;
currentSize: any;
data: Buffer<ArrayBufferLike> | null;
lastAccess: number;
newlinePositions: any[];
linesCacheValid: boolean;
/**
* Update page with new data and invalidate caches as needed
* @param {Buffer} data - New data
*/
updateData(data: Buffer): void;
/**
* Rebuild the newline positions cache
* @param {Buffer} data - Page data
* @private
*/
private _rebuildLineCache;
/**
* Ensure line cache is valid and up to date
*/
ensureLineCacheValid(): void;
/**
* Get the number of newlines in this page
* @returns {number} - Number of \n characters
*/
getNewlineCount(): number;
/**
* Get global line starts contributed by this page
* @param {number} pageVirtualStart - Virtual start address of this page
* @returns {number[]} - Array of global line start positions
*/
getGlobalLineStarts(pageVirtualStart: number): number[];
/**
* Update line cache after a modification within this page
* @param {number} offset - Offset within page where modification occurred
* @param {number} deletedBytes - Number of bytes deleted
* @param {Buffer} insertedData - Data that was inserted
*/
updateAfterModification(_offset: any, _deletedBytes: any, _insertedData: any): void;
/**
* Verify page integrity against original file
* @param {Buffer} originalData - Data from original file
* @returns {boolean} - True if page matches original
*/
verifyIntegrity(originalData: Buffer): boolean;
/**
* Get memory usage statistics for this page
* @returns {Object} - Memory usage info
*/
getMemoryStats(): Object;
}
export class LineInfo {
constructor(startOffset: any, length: any, endsWithNewline?: boolean);
startOffset: any;
length: any;
endsWithNewline: boolean;
get endOffset(): any;
get contentLength(): any;
}
export class MarkInfo {
constructor(name: any, pageOffset: any, virtualAddress: any);
name: any;
pageOffset: any;
virtualAddress: any;
}
//# sourceMappingURL=page-info.d.ts.map