unison-codebase-sqlite-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

U.Codebase.Sqlite.Operations

Synopsis

branches

loadCausalHashAtPath :: CausalHash -> [NameSegment] -> Transaction (Maybe CausalHash) Source #

Load the causal hash at the given path from the provided root, if Nothing, use the codebase root.

expectCausalHashAtPath :: CausalHash -> [NameSegment] -> Transaction CausalHash Source #

Expect the causal hash at the given path from the provided root, if Nothing, use the codebase root.

expectNamespaceStatsByHash :: BranchHash -> Transaction NamespaceStats Source #

Looks up statistics for a given branch, if none exist, we compute them and save them then return them.

expectNamespaceStatsByHashId :: BranchHashId -> Transaction NamespaceStats Source #

Looks up statistics for a given branch, if none exist, we compute them and save them then return them.

tryGetSquashResult :: BranchHash -> Transaction (Maybe CausalHash) Source #

Get the causal hash which would be the result of squashing the provided branch hash. Returns Nothing if we haven't computed it before.

saveSquashResult :: BranchHash -> CausalHash -> Transaction () Source #

Saves the result of a squash

terms

saveTermComponent Source #

Arguments

:: HashHandle 
-> Maybe ByteString

The serialized term component if we already have it e.g. via sync

-> Hash

term component hash

-> [(Term Symbol, Type Symbol)]

term component

-> Transaction ObjectId 

decls

terms/decls

patches

test for stuff in codebase

watch expression cache

loadWatch :: WatchKind -> Id -> MaybeT Transaction (Term Symbol) Source #

returns Nothing if the expression isn't cached.

clearWatches :: Transaction () Source #

Delete all watches that were put by putWatch.

indexes

nearest common ancestor

prefix index

dependents index

dependents :: DependentsSelector -> Reference -> Transaction (Set Id) Source #

returns a list of known definitions referencing r

dependentsOfComponent :: Hash -> Transaction (Set Id) Source #

returns a list of known definitions referencing h

directDependentsWithinScope :: Set Id -> Set Reference -> Transaction (DefnsF Set TermReferenceId TypeReferenceId) Source #

`directDependentsWithinScope scope query` returns all direct dependents of query that are in scope (not including query itself).

transitiveDependentsWithinScope :: DefnsF Set TermReferenceId TypeReferenceId -> Set Reference -> Transaction (DefnsF Set TermReferenceId TypeReferenceId) Source #

`transitiveDependentsWithinScope scope query` returns all transitive dependents of query that are in scope (not including query itself).

type index

type mentions index

Projects

reflog

getDeprecatedRootReflog :: Int -> Transaction [Entry CausalHash Text] Source #

Gets the specified number of reflog entries in chronological order, most recent first.

getProjectReflog :: Int -> ProjectId -> Transaction [Entry Project ProjectBranch CausalHash] Source #

Gets the specified number of reflog entries for the given project in chronological order, most recent first.

getProjectBranchReflog :: Int -> ProjectBranchId -> Transaction [Entry Project ProjectBranch CausalHash] Source #

Gets the specified number of reflog entries for the specified ProjectBranch in chronological order, most recent first.

getGlobalReflog :: Int -> Transaction [Entry Project ProjectBranch CausalHash] Source #

Gets the specified number of reflog entries in chronological order, most recent first.

low-level stuff

saveDbBranch :: HashHandle -> BranchHash -> NamespaceStats -> DbBranchV -> Transaction BranchObjectId Source #

Save a DbBranch, given its hash (which the caller is expected to produce from the branch).

Note: long-standing question: should this package depend on the hashing package? (If so, we would only need to take the DbBranch, and hash internally).

saveDbBranchUnderHashId :: HashHandle -> BranchHashId -> NamespaceStats -> DbBranchV -> Transaction BranchObjectId Source #

Variant of saveDbBranch that might be preferred by callers that already have a hash id, not a hash.

expectDbBranchByCausalHashId :: CausalHashId -> Transaction DbBranch Source #

Expect a branch value given its causal hash id.

reference conversions

somewhat unexpectedly unused definitions

diffPatch :: LocalPatch -> LocalPatch -> LocalPatchDiff Source #

produces a diff diff = full - ref; full = diff + ref

s2cDecl :: LocalIds -> Decl Symbol -> Transaction (Decl Symbol) Source #

Unlocalize a decl.

derivedDependencies :: Id -> Transaction (Set Id) Source #

returns empty set for unknown inputs; doesn't distinguish between term and decl

internal stuff that probably need not be exported, but the 1->2 migration needs it

data BranchV m Source #

Constructors

BranchV2 !(Branch m) 
BranchV3 !(BranchV3 m)