import { AvailabilityState } from '../../enumerations/availabilityState'; import type { BlockId } from '../branded/primitives/blockId'; import { IBlockMetadata } from '../storage/blockMetadata'; import { PoolId } from '../storage/pooledBlockStore'; /** * Location record for a block, tracking which node holds a copy * and metadata about that copy. * * @see Requirements 2.1, 2.2, 2.3 */ export interface ILocationRecord { /** * Unique identifier of the node holding this block */ nodeId: string; /** * Timestamp when this node was last confirmed to have the block */ lastSeen: Date; /** * Whether this node holds the authoritative (original) copy */ isAuthoritative: boolean; /** * Optional latency measurement to this node in milliseconds */ latencyMs?: number; /** * Pool the block is stored in on this node */ poolId?: PoolId; } /** * Extended block metadata with availability and location information. * Extends the base IBlockMetadata to support distributed block discovery. * * @see Requirements 2.1, 2.2, 2.3 */ export interface IBlockMetadataWithLocation extends IBlockMetadata { /** * Current availability state of the block */ availabilityState: AvailabilityState; /** * Nodes known to hold this block */ locationRecords: ILocationRecord[]; /** * When the location information was last updated */ locationUpdatedAt: Date; } /** * Create default location metadata for a new local block. * Used when storing a block locally as the authoritative copy. * * @param localNodeId - The ID of the local node storing the block * @returns Default location metadata fields for a new local block */ export declare function createDefaultLocationMetadata(localNodeId: string): Pick; /** * Serializable representation of ILocationRecord with Date fields as ISO strings */ export interface SerializedLocationRecord { nodeId: string; lastSeen: string; isAuthoritative: boolean; latencyMs?: number; poolId?: string; } /** * Serializable representation of IBlockMetadataWithLocation */ export interface SerializedBlockMetadataWithLocation { blockId: BlockId; createdAt: string; expiresAt: string | null; durabilityLevel: string; parityBlockIds: string[]; accessCount: number; lastAccessedAt: string; replicationStatus: string; targetReplicationFactor: number; replicaNodeIds: string[]; size: number; checksum: string; availabilityState: AvailabilityState; locationRecords: SerializedLocationRecord[]; locationUpdatedAt: string; } /** * Convert ILocationRecord to JSON-serializable format * @param record - The location record to serialize * @returns Serialized location record with Date fields as ISO strings */ export declare function locationRecordToJSON(record: ILocationRecord): SerializedLocationRecord; /** * Convert serialized location record back to ILocationRecord * @param serialized - The serialized location record * @returns Location record with Date objects * @throws Error if validation fails */ export declare function locationRecordFromJSON(serialized: SerializedLocationRecord): ILocationRecord; /** * Convert IBlockMetadataWithLocation to JSON-serializable format * @param metadata - The block metadata with location to serialize * @returns Serialized metadata with Date fields as ISO strings */ export declare function blockMetadataWithLocationToJSON(metadata: IBlockMetadataWithLocation): SerializedBlockMetadataWithLocation; /** * Convert serialized block metadata back to IBlockMetadataWithLocation * @param serialized - The serialized block metadata * @returns Block metadata with Date objects * @throws Error if validation fails */ export declare function blockMetadataWithLocationFromJSON(serialized: SerializedBlockMetadataWithLocation): IBlockMetadataWithLocation; //# sourceMappingURL=locationRecord.d.ts.map