import type { SerializableObject } from 'with-cache-normalization/dist/domain/NormalizeCacheValueMethod'; import { type SimpleAsyncCache } from 'with-simple-cache'; export declare const isValidPointerState: (state: SerializableObject) => state is { queries: string[]; }; /** * adds a query key to a dependency pointer * * constraints * - each dependency pointer may have 0 or more queries already dependent on it * - we must make sure to retain all existing queries dependent on it, adding a new key * - we must make sure that parallel writes don't overwrite eachother -> miss data * * strategy * - within a in-memory bottleneck of maxConcurrency=1 per dependency.pointer... * - objective: eliminate in-memory parallel writes on the same pointer * - strategy: * - finsert bottleneck for pointer via simple-in-memory-cache * - bottleneck.schedule w/ concurrency = 1 -> only one write at a time * - log.warn if backed up w/ more than 10 parallel writes at a time per partition -> may want todo batch execute // TODO * - ...update the queries identified as dependent for the pointer * - look up all of the existing queries dependent on the pointer * - append this query * - write to cache * * todo: enable optimistic write locks -> prevent concurrent writes across machines, not just in memory */ export declare const addQueryKeyToDependencyPointer: ({ cache, pointer, queryKey, }: { cache: SimpleAsyncCache; pointer: string; queryKey: string; }) => Promise;