Add hashBranchFormatFull to Hash Handle

This commit is contained in:
Chris Penner 2023-08-11 17:22:26 -07:00
parent d6b5308a52
commit 3e88ddab37
3 changed files with 18 additions and 3 deletions

View File

@ -3,13 +3,16 @@ module U.Codebase.Sqlite.V2.HashHandle
)
where
import Data.Function ((&))
import Data.Set qualified as Set
import U.Codebase.Branch.Hashing qualified as H2
import U.Codebase.Causal.Hashing qualified as H2
import U.Codebase.HashTags (BranchHash (..))
import U.Codebase.Sqlite.Branch.Format qualified as BranchFormat
import U.Codebase.Sqlite.HashHandle
import U.Util.Type (removeAllEffectVars)
import Unison.Hashing.V2 qualified as H2
import Unison.Hashing.V2.Convert2 (h2ToV2Reference, v2ToH2Type, v2ToH2TypeD)
import Unison.Hashing.V2.Convert2 (h2ToV2Reference, hashBranchFormatToH2Branch, v2ToH2Type, v2ToH2TypeD)
v2HashHandle :: HashHandle
v2HashHandle =
@ -19,5 +22,10 @@ v2HashHandle =
toReferenceDecl = \h -> h2ToV2Reference . H2.typeToReference . v2ToH2TypeD h . removeAllEffectVars,
toReferenceDeclMentions = \h -> Set.map h2ToV2Reference . H2.typeToReferenceMentions . v2ToH2TypeD h . removeAllEffectVars,
hashBranch = H2.hashBranch,
hashCausal = H2.hashCausal
hashCausal = H2.hashCausal,
hashBranchFormatFull = \localIds localBranch ->
BranchFormat.localToHashBranch localIds localBranch
& hashBranchFormatToH2Branch
& H2.contentHash
& BranchHash
}

View File

@ -4,6 +4,7 @@ module U.Codebase.Sqlite.Branch.Format
HashBranchFormat,
BranchLocalIds,
BranchLocalIds' (..),
HashBranchLocalIds,
SyncBranchFormat,
SyncBranchFormat' (..),
LocalBranchBytes (..),

View File

@ -6,6 +6,8 @@ where
import U.Codebase.Branch.Type (Branch)
import U.Codebase.HashTags
import U.Codebase.Reference qualified as C
import U.Codebase.Sqlite.Branch.Format (HashBranchLocalIds)
import U.Codebase.Sqlite.Branch.Full (LocalBranch)
import U.Codebase.Sqlite.Symbol (Symbol)
import U.Codebase.Term qualified as C.Term
import U.Codebase.Type qualified as C.Type
@ -27,5 +29,9 @@ data HashHandle = HashHandle
BranchHash ->
-- The causal's parents
Set CausalHash ->
CausalHash
CausalHash,
hashBranchFormatFull ::
HashBranchLocalIds ->
LocalBranch ->
BranchHash
}