OpamGlobalStateLoading and handling of the global state of an opam root
val load : 'a OpamStateTypes.lock -> 'a OpamStateTypes.global_stateLoads the global state (from the opam root obtained through OpamStateConfig.(!r.root))
val with_ :
'a OpamStateTypes.lock ->
('a OpamStateTypes.global_state -> 'b) ->
'bLoads the global state as load, and calls the given function while keeping it locked (as per the lock argument), releasing the lock afterwards
val all_installed : 'a OpamStateTypes.global_state -> OpamTypes.package_setThe set of all installed packages, in any switch
val switches : 'a OpamStateTypes.global_state -> OpamTypes.switch listval fold_switches :
(OpamTypes.switch -> OpamTypes.switch_selections -> 'a -> 'a) ->
'b OpamStateTypes.global_state ->
'a ->
'aFold over switches, using switch selections. Switch selection file switch-state is loaded only read-only; no further checks are done on the opam root version.
val switch_exists : 'a OpamStateTypes.global_state -> OpamTypes.switch -> boolChecks a switch for existence: either configured in the opam root, or an existing local switch with a configuration file pointing to the current root
val all_installed_versions :
'a OpamStateTypes.global_state ->
OpamTypes.switch list OpamTypes.package_mapReturns the map of all installed packages to the list of switch(es) they're installed in.
val repos_list :
'a OpamStateTypes.global_state ->
OpamTypes.repository_name listDefault list of repositories to get packages from, ordered by decreasing priority. This can be overridden by switch-specific selections, and does not have to include all configured repositories.
val unlock :
'a OpamStateTypes.global_state ->
OpamStateTypes.unlocked OpamStateTypes.global_stateReleases any locks on the given global_state
val drop : 'a OpamStateTypes.global_state -> unitReleases any locks on the given global state and then ignores it.
Using drop gt is equivalent to ignore (unlock gt), and safer than other uses of ignore where it is not enforced by the type-system that the value is unlocked before it is lost.
val with_write_lock :
?dontblock:bool ->
'a OpamStateTypes.global_state ->
(OpamStateTypes.rw OpamStateTypes.global_state ->
'b * 'c OpamStateTypes.global_state) ->
'b * 'a OpamStateTypes.global_stateCalls the provided function, ensuring a temporary write lock on the given global state
val write : OpamStateTypes.rw OpamStateTypes.global_state -> unitWrites back the global configuration file ~/.opam/config
val fix_switch_list :
'a OpamStateTypes.global_state ->
'a OpamStateTypes.global_stateUpdates the configured list of switches, making sure the current switch is registered if it is set and exists, and removing any non-existing switches. Writes back to disk if possible (ie lock is available)