@lodestar/beacon-node
Version:
A Typescript implementation of the beacon chain
36 lines • 1.3 kB
TypeScript
import { Slot, SubnetID } from "@lodestar/types";
export type RequestedSubnet = {
subnet: SubnetID;
/**
* Slot after which the network will stop maintaining a min number of peers
* connected to `subnetId`RequestedSubnet
*/
toSlot: Slot;
};
/**
* Track requested subnets by `toSlot`
*/
export declare class SubnetMap {
/** Map of subnets and the slot until they are needed */
private subnets;
get size(): number;
has(subnet: SubnetID): boolean;
/**
* Register requested subnets, extends toSlot if same subnet.
**/
request(requestedSubnet: RequestedSubnet): void;
/**
* Get last active slot of a subnet.
*/
getToSlot(subnet: SubnetID): Slot | undefined;
isActiveAtSlot(subnet: SubnetID, slot: Slot): boolean;
/** Return subnetIds with a `toSlot` equal greater than `currentSlot` */
getActive(currentSlot: Slot): SubnetID[];
/** Return subnetIds with a `toSlot` equal greater than `currentSlot` */
getActiveTtl(currentSlot: Slot): RequestedSubnet[];
/** Return subnetIds with a `toSlot` less than `currentSlot`. Also deletes expired entries */
getExpired(currentSlot: Slot): SubnetID[];
getAll(): SubnetID[];
delete(subnet: SubnetID): void;
}
//# sourceMappingURL=subnetMap.d.ts.map