- SwiftDocC
- NavigatorIndex
- readNavigatorIndex(url:bundleIdentifier:readNavigatorTree:presentationIdentifier:onNodeRead:)
Type Method
readNavigatorIndex(url:bundleIdentifier:readNavigatorTree:presentationIdentifier:onNodeRead:)
Initializes a NavigatorIndex from a given path on disk.
static func readNavigatorIndex(url: URL, bundleIdentifier: String? = nil, readNavigatorTree: Bool = true, presentationIdentifier: String? = nil, onNodeRead: ((NavigatorTree.Node) -> Void)? = nil) throws -> NavigatorIndex
Parameters
urlThe URL pointing to the path from which the index should be read.
bundleIdentifierThe name of the bundle the index is referring to.
readNavigatorTreeIndicates if the init the navigator tree should be read from the disk now or later, if false, then readNavigatorTree needs to be called later. Default: true.
presentationIdentifierIndicates if the index has an identifier useful for presentation contexts.
onNodeReadAn action to perform after reading a node. This allows clients to perform arbitrary actions on the node while it is being read from disk. This is useful for clients wanting to attach data to attributes.
Discussion
Most uses should be made using just the url parameter:
let indexFilePath = URL(string: "file://path/to/index/on/disk")
let index = NavigatorIndex.readNavigatorIndex(url: indexFilePath)
Throws
A NavigatorIndex.Error describing the nature of the problem.
Note
The index powered by LMDB opens in readOnly mode to avoid performing a filesystem lock which fails without writing permissions. As this initializer opens a built index, write permission is not expected.