Repository

class Repository(rootName: String, val fileName: File) : Closeable

A Repository manages a persistent IndexedFile of compiled modules.

**Metadata:**
1. #modules
2. For each module,
2a. moduleArchive

**ModuleArchive:**
1. UTF8 rootRelativeName
2. digestCache size
3. For each cached digest,
3a. timestamp (long)
3b. digest (32 bytes)
4. #versions
5. For each version,
5a. ModuleVersionKey
5b. ModuleVersion

**ModuleVersionKey:**
1. isPackage (byte)
2. digest (32 bytes)

**ModuleVersion:**
1. moduleSize (long)
2. localImportNames size (int)
3. For each import name,
3a. UTF8 import name
4. entryPoints size (int)
5. For each entry point,
5a. UTF8 entry point name
6. compilations size (int)
7. For each compilation.
7a. ModuleCompilationKey
7b. ModuleCompilation
8. moduleHeaderRecordNumber (long)
9. stacksRecordNumber (long)

**ModuleCompilationKey:**
1. predecessorCompilationTimes length (int)
2. For each predecessor compilation time,
2a. predecessor compilation time (long)

**ModuleCompilation:**
1. compilationTime (long)
2. recordNumber (long)
3. recordNumberOfBlockPhrases (long)
4. recordNumberOfManifestEntries (long)
5. recordNumberOfStyling (long)

Author

Todd L Smith

Richard Arriaga

Parameters

rootName

The name of the Avail root represented by the Repository.

fileName

The path to the indexed repository.

Throws

org.availlang.persistence.IndexedFileException

If an exception occurs.

Constructors

Link copied to clipboard
fun Repository(rootName: String, fileName: File)

Construct a new Repository.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class LimitedCache<K, V>(maximumSize: Int) : LinkedHashMap<K, V>

A Map which discards the oldest entry whenever an attempt is made to store more than the maximumSize elements in it.

Link copied to clipboard
inner class ModuleArchive

All information associated with a particular module name in this module, across all known versions.

Link copied to clipboard
inner class ModuleCompilation

Information kept in memory about a compilation of a module.

Link copied to clipboard
class ModuleCompilationKey

An immutable key which specifies a version of a module and its context at the time of compilation. It does not explicitly contain the ModuleVersionKey, but it includes the compilation times of the module's predecessors.

Link copied to clipboard
inner class ModuleVersion

Information kept in memory about a specific version of a module file.

Link copied to clipboard
class ModuleVersionKey : Comparable<Repository.ModuleVersionKey>

An immutable key which specifies a version of some module. It includes whether the module's name refers to a package (a directory), and the digest of the file's contents.

Link copied to clipboard
class StylingRecord

Styling information that was collected during compilation of a module.

Functions

Link copied to clipboard
fun cleanModulesUnder(rootRelativePath: String)

Remove all compilations of the specified module. If it's a package, remove all compilations of any contained modules.

Link copied to clipboard
fun clear()

Clear the underlying Repository and discard any cached data. Set up the repository for subsequent usage.

Link copied to clipboard
open override fun close()

Close the underlying IndexedFile.

Link copied to clipboard
fun commit()

Write all pending data and metadata to the Repository.

Link copied to clipboard
fun commitIfStaleChanges(maximumChangeAgeMs: Long)

Commit the pending changes if they're more than the specified number of milliseconds old.

Link copied to clipboard
fun getArchive(rootRelativeName: String): Repository.ModuleArchive

Look up the ModuleArchive with the specified name, creating one and adding it to my moduleMap if necessary.

Link copied to clipboard
fun markDirty()

If this repository is not already dirty, mark it as dirty as of now.

Link copied to clipboard
fun reopenIfNecessary()

Reopen the IndexedFile and reinitialize the Repository.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val fileName: File

The filename of the IndexedFile.