/** * (c) Facebook, Inc. and its affiliates. Confidential and proprietary. * * @emails oncall+recoil * @flow strict-local * @format */ 'use strict'; import type { GetHandlers, NodeCacheRoute, NodeValueGet, SetHandlers, TreeCacheBranch, TreeCacheLeaf, TreeCacheNode } from './Recoil_TreeCacheImplementationType'; const invariant = require('../util/Recoil_invariant'); const nullthrows = require('../util/Recoil_nullthrows'); export type Options = { mapNodeValue?: (value: mixed) => mixed, onHit?: (node: TreeCacheLeaf) => void, onSet?: (node: TreeCacheLeaf) => void, }; declare class TreeCache { _numLeafs: number, _root: TreeCacheNode | null, _onHit: $NonMaybeType<$PropertyType, 'onHit'>>, _onSet: $NonMaybeType<$PropertyType, 'onSet'>>, _mapNodeValue: $NonMaybeType<$PropertyType, 'mapNodeValue'>>, constructor(options?: Options): any, size(): number, root(): TreeCacheNode | null, get(getNodeValue: NodeValueGet, handlers?: GetHandlers): ?T, getLeafNode(getNodeValue: NodeValueGet, handlers?: GetHandlers): ?TreeCacheLeaf, set(route: NodeCacheRoute, value: T, handlers?: SetHandlers): void, delete(node: TreeCacheNode): boolean, clear(): void, } declare var findLeaf: (root: ?TreeCacheNode, getNodeValue: NodeValueGet, handlers?: GetHandlers) => ?TreeCacheLeaf; declare var addLeaf: (root: ?TreeCacheNode, route: NodeCacheRoute, parent: ?TreeCacheBranch, value: T, branchKey: ?mixed, handlers?: SetHandlers) => TreeCacheNode; declare var pruneNodeFromTree: (root: TreeCacheNode, node: TreeCacheNode, parent: ?TreeCacheBranch) => boolean; declare var pruneUpstreamBranches: (root: TreeCacheNode, branchNode: TreeCacheBranch, parent: ?TreeCacheBranch) => boolean; declare var countDownstreamLeaves: (node: TreeCacheNode) => number; module.exports = { TreeCache };