import { type Action, type Graph, type LinkMap } from './types.js'; import { type Hash } from 'util/index.js'; export declare const EMPTY: LinkMap; /** * Collects a graph's most recent links (i.e. the heads and their predecessors, up to a given * depth), and maps each link's hash to its parents. * * ``` * ┌─ e ─ g ─┐ * ┌─ c ─ d ─┤ ├─ o ─┐ * a ─ b ─┤ └─── f ───┤ ├─ n * ├──── h ──── i ─────┘ │ * └───── j ─── k ── l ──────┘ * ``` * For example, given this graph and `depth: 2`, this function would return * ``` * { * l: [k], * n: [l, o], * o: [f, g, i], * } * ``` * This map is generated to be included in sync messages, and helps peers that have diverged from * each other figure out the most recent links they have in common. * */ export declare const getParentMap: ({ graph, depth, start, end, prev, hashes, }: { /** The graph to collect links from. */ graph: Graph; /** * How many levels back we want to go in the graph. If omitted, we'll get a map covering the whole * graph (up to `end`). The actual number of links we'll collect depends on how much branching * there is. If not provided, there is no depth limit. */ depth?: number; /** The link(s) we want to start with — e.g. the "most recent" links to work back from. */ start?: Hash[]; /** * The link(s) that we should stop at — the root by default. For example this could contain the * last heads we had in common with a peer, since we wouldn't need to explore further back. */ end?: Hash[]; /** * If we're not able to find a common ancestor with the recent links we were given, we'll ask to * go back further. In that case we provide the last result we got, and pick up from there. */ prev?: LinkMap; hashes?: Hash[]; }) => LinkMap; export declare const getTails: (linkMap: LinkMap) => Hash[]; export declare const getChildMap: (graph: Graph) => LinkMap; export declare const invertLinkMap: (linkMap: LinkMap) => LinkMap; //# sourceMappingURL=getParentMap.d.ts.map