PartitionHandlerManager

Class in @sentio/sdk

Defined in @sentio/sdk

Generic manager for handling partition logic across all chain plugins. Provides a unified interface for registering, storing, and processing partition handlers. Chain-specific logic should remain in individual plugins.

Constructors

Constructor

new PartitionHandlerManager(): PartitionHandlerManager;

Returns

PartitionHandlerManager

Methods

clear()

clear(): void;

Clear all partition handlers (useful for testing or reinitialization)

Returns

void


getHandlerCount()

getHandlerCount(handlerType: HandlerType): number;

Get the number of registered handlers for a specific handler type

Parameters

ParameterTypeDescription
handlerTypeHandlerTypeThe handler type to check

Returns

number

Number of registered handlers for this type


getRegisteredHandlerTypes()

getRegisteredHandlerTypes(): HandlerType[];

Get all registered handler types

Returns

HandlerType[]

Array of handler types that have registered partition handlers


processPartitionForHandlerType()

processPartitionForHandlerType(
   handlerType: HandlerType, 
   handlerIds: number[], 
   data: any
): Promise<Record<number, ProcessStreamResponse_Partitions_Partition>>;

Process partition logic for a specific handler type

Parameters

ParameterTypeDescription
handlerTypeHandlerTypeThe type of handler being processed
handlerIdsnumber[]Array of handler IDs to process
dataanyThe data to pass to partition handlers

Returns

Promise<Record<number, ProcessStreamResponse_Partitions_Partition>>

Record mapping handler IDs to partition results


registerPartitionHandler()

registerPartitionHandler(
   handlerType: HandlerType, 
   handlerId: number, 
   partitionHandler?: PartitionHandlerFunction
): void;

Register a partition handler for a specific handler type and ID

Parameters

ParameterTypeDescription
handlerTypeHandlerTypeThe type of handler (e.g., HandlerType.ETH_LOG, HandlerType.APT_EVENT)
handlerIdnumberThe unique ID for this handler instance
partitionHandler?PartitionHandlerFunctionThe partition handler function (optional)

Returns

void

On this page