Indexed File
IndexedFile is a record journal. Records may be added, explicitly committed, and looked up by record number. A single arbitrary metadata section can be attached to an indexed file (and will be replaced by subsequent attachments). Concurrent read access is supported for multiple threads, drivers, and external OS processes. Only one writer is permitted.
The exclusive longTermWriterLock is acquired automatically when performing an add, a commit, or modifying the metadata, if it isn't already owned. If it wasn't owned, a refresh always takes place, ensuring the write is relative to the latest consistent state of the file, which the lock secures against change by other processes. At the end of a commit, the lock is always released, which allows other blocked processes to mutate the file, having automatically refreshed their own content as above.
Author
Todd L Smith
Mark van Gulik
Skatje Myers
Parameters
An optional extension function, whose presence indicates the file should be initialized to a valid state that contains no records. At that point, the extension function will run, and the file will be renamed to the given fileReference.
The unique sequence of bytes that identifies the nature of the data in the file's records.
The maximum number of data blocks to cache in memory. Memory pressure can remove some of these entries, down to the strongCacheSize
The number of recently accessed data blocks that are guaranteed to be kept resident in memory, even under memory pressure.
A function that checks whether the version number found in the existing file and the given version are compatible.
Types
ByteArrayOutputStream provides direct (unsafe) access to the backing byte array (without requiring it to be copied).