A collection: a typed set of documents under a prefix of a store, whose keys have paths by a layout written as code and whose bytes are made by a codec. Every document comes with the revision it was read at, and every write states what it expects, as the store does. What a collection may do is in its type: a collection of a store that cannot write has no put, and update, the read-modify-write that retries where another writer got there first, needs a store with cas. A listing reads the objects lazily, and an object that is not a good document is a finding beside the others.
The one cast of the module is in collection: it builds the object with every method and gives it the type its capabilities say, as makeStore does for a store. The methods that need a capability the store does not have refuse at run time through the store, and update and migrate refuse before they read.
type CollectionConfig<T, K> = {
/** Where the documents are in the store. */
readonly prefix: Prefix;
readonly lay…(678 characters)
typeCollectionConfig<T, K> = {
/** Where the documents are in the store. */readonlyprefix:Prefix;
readonlylayout:Layout<K>;
readonlycodec:Codec<T>;
/** The attempts of an update where another writer changed the document first; 5 where not given. */readonlyattempts?:number;
/** How many documents a page lists and reads; 100 where not given. */readonlypageSize?:number;
/** How many documents are read at once in a page; 8 where not given. */readonlyreaders?:number;
/** What an update waits for between attempts, given the attempt that failed: it does not wait where not given. */readonlypause?: (attempt:number) =>Promise<void>;
};