Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data TransactionIdLookup
- data TransactionIdHeadBacktrack
- data TransactionGraphOperator
- isCommit :: TransactionGraphOperator -> Bool
- data ROTransactionGraphOperator
- bootstrapTransactionGraph :: UTCTime -> TransactionId -> DatabaseContext -> TransactionGraph
- freshTransactionGraph :: DatabaseContext -> IO (TransactionGraph, TransactionId)
- emptyTransactionGraph :: TransactionGraph
- transactionForHead :: HeadName -> TransactionGraph -> Maybe Transaction
- headList :: TransactionGraph -> [(HeadName, TransactionId)]
- headNameForTransaction :: Transaction -> TransactionGraph -> Maybe HeadName
- transactionsForIds :: Set TransactionId -> TransactionGraph -> Either RelationalError (Set Transaction)
- isRootTransaction :: Transaction -> Bool
- rootTransactions :: TransactionGraph -> Set Transaction
- parentTransactions :: Transaction -> TransactionGraph -> Either RelationalError (Set Transaction)
- childTransactions :: Transaction -> TransactionGraph -> Either RelationalError (Set Transaction)
- addBranch :: UTCTime -> TransactionId -> HeadName -> TransactionId -> TransactionGraph -> Either RelationalError (Transaction, TransactionGraph)
- addDisconnectedTransaction :: UTCTime -> TransactionId -> HeadName -> DisconnectedTransaction -> TransactionGraph -> Either RelationalError (Transaction, TransactionGraph)
- addTransactionToGraph :: HeadName -> Transaction -> TransactionGraph -> Either RelationalError (Transaction, TransactionGraph)
- newTransUncommittedReplace :: Transaction -> Transaction
- validateGraph :: TransactionGraph -> Maybe [RelationalError]
- walkParentTransactions :: Set TransactionId -> TransactionGraph -> Transaction -> Maybe RelationalError
- walkChildTransactions :: Set TransactionId -> TransactionGraph -> Transaction -> Maybe RelationalError
- evalGraphOp :: UTCTime -> TransactionId -> DisconnectedTransaction -> TransactionGraph -> TransactionGraphOperator -> Either RelationalError (DisconnectedTransaction, TransactionGraph)
- graphAsRelation :: DisconnectedTransaction -> TransactionGraph -> Either RelationalError Relation
- transactionParentsRelation :: Transaction -> TransactionGraph -> Either RelationalError Relation
- createMergeTransaction :: UTCTime -> TransactionId -> MergeStrategy -> (Transaction, Transaction) -> GraphRefRelationalExprM Transaction
- validateHeadName :: HeadName -> TransactionGraph -> (Transaction, Transaction) -> GraphRefRelationalExprM Transaction
- subGraphOfFirstCommonAncestor :: TransactionGraph -> TransactionHeads -> Transaction -> Transaction -> Set Transaction -> Either RelationalError TransactionGraph
- pathToTransaction :: TransactionGraph -> Transaction -> Transaction -> Set Transaction -> Either RelationalError (Set Transaction)
- mergeTransactions :: UTCTime -> TransactionId -> TransactionId -> MergeStrategy -> (HeadName, HeadName) -> GraphRefRelationalExprM (DisconnectedTransaction, TransactionGraph)
- showTransactionStructureX :: Bool -> Transaction -> TransactionGraph -> String
- showGraphStructureX :: Bool -> TransactionGraph -> String
- filterSubGraph :: TransactionGraph -> TransactionHeads -> Either RelationalError TransactionGraph
- createUnionMergeTransaction :: UTCTime -> TransactionId -> MergeStrategy -> (Transaction, Transaction) -> GraphRefRelationalExprM Transaction
- lookupTransaction :: TransactionGraph -> TransactionIdLookup -> Either RelationalError Transaction
- traverseGraph :: TransactionGraph -> TransactionId -> [TransactionIdHeadBacktrack] -> Either RelationalError TransactionId
- backtrackGraph :: TransactionGraph -> TransactionId -> TransactionIdHeadBacktrack -> Either RelationalError TransactionId
- autoMergeToHead :: UTCTime -> (TransactionId, TransactionId, TransactionId) -> DisconnectedTransaction -> HeadName -> MergeStrategy -> TransactionGraph -> Either RelationalError (DisconnectedTransaction, TransactionGraph)
- addMerkleHash :: TransactionGraph -> Transaction -> Transaction
- calculateMerkleHash :: Transaction -> TransactionGraph -> MerkleHash
- validateMerkleHash :: Transaction -> TransactionGraph -> Either MerkleValidationError ()
- data MerkleValidationError = MerkleValidationError TransactionId MerkleHash MerkleHash
- validateMerkleHashes :: TransactionGraph -> Either [MerkleValidationError] ()
- validateConnectivity :: TransactionGraph -> Either RelationalError TransactionGraph
Documentation
data TransactionIdLookup Source #
Record a lookup for a specific transaction in the graph.
Instances
data TransactionIdHeadBacktrack Source #
Used for git-style head backtracking such as topic~3^2.
TransactionIdHeadParentBacktrack Int | git equivalent of ~v: walk back n parents, arbitrarily choosing a parent when a choice must be made |
TransactionIdHeadBranchBacktrack Int | git equivalent of ^: walk back one parent level to the nth arbitrarily-chosen parent |
TransactionStampHeadBacktrack UTCTime | git equivalent of 'git-rev-list -n 1 --before X' find the first transaction which was created before the timestamp |
Instances
data TransactionGraphOperator Source #
Operators which manipulate a transaction graph and which transaction the current Session
is based upon.
JumpToHead HeadName | |
JumpToTransaction TransactionId | |
WalkBackToTime UTCTime | |
Branch HeadName | |
DeleteBranch HeadName | |
MergeTransactions MergeStrategy HeadName HeadName | |
Commit | |
Rollback |
Instances
data ROTransactionGraphOperator Source #
Instances
bootstrapTransactionGraph :: UTCTime -> TransactionId -> DatabaseContext -> TransactionGraph Source #
freshTransactionGraph :: DatabaseContext -> IO (TransactionGraph, TransactionId) Source #
Create a transaction graph from a context.
headList :: TransactionGraph -> [(HeadName, TransactionId)] Source #
transactionsForIds :: Set TransactionId -> TransactionGraph -> Either RelationalError (Set Transaction) Source #
isRootTransaction :: Transaction -> Bool Source #
A root transaction terminates a graph and has no parents.
parentTransactions :: Transaction -> TransactionGraph -> Either RelationalError (Set Transaction) Source #
childTransactions :: Transaction -> TransactionGraph -> Either RelationalError (Set Transaction) Source #
addBranch :: UTCTime -> TransactionId -> HeadName -> TransactionId -> TransactionGraph -> Either RelationalError (Transaction, TransactionGraph) Source #
addDisconnectedTransaction :: UTCTime -> TransactionId -> HeadName -> DisconnectedTransaction -> TransactionGraph -> Either RelationalError (Transaction, TransactionGraph) Source #
addTransactionToGraph :: HeadName -> Transaction -> TransactionGraph -> Either RelationalError (Transaction, TransactionGraph) Source #
walkParentTransactions :: Set TransactionId -> TransactionGraph -> Transaction -> Maybe RelationalError Source #
walkChildTransactions :: Set TransactionId -> TransactionGraph -> Transaction -> Maybe RelationalError Source #
evalGraphOp :: UTCTime -> TransactionId -> DisconnectedTransaction -> TransactionGraph -> TransactionGraphOperator -> Either RelationalError (DisconnectedTransaction, TransactionGraph) Source #
graphAsRelation :: DisconnectedTransaction -> TransactionGraph -> Either RelationalError Relation Source #
transactionParentsRelation :: Transaction -> TransactionGraph -> Either RelationalError Relation Source #
createMergeTransaction :: UTCTime -> TransactionId -> MergeStrategy -> (Transaction, Transaction) -> GraphRefRelationalExprM Transaction Source #
Execute the merge strategy against the transactions, returning a new transaction which can be then added to the transaction graph
validateHeadName :: HeadName -> TransactionGraph -> (Transaction, Transaction) -> GraphRefRelationalExprM Transaction Source #
Returns the correct Transaction for the branch name in the graph and ensures that it is one of the two transaction arguments in the tuple.
subGraphOfFirstCommonAncestor :: TransactionGraph -> TransactionHeads -> Transaction -> Transaction -> Set Transaction -> Either RelationalError TransactionGraph Source #
pathToTransaction :: TransactionGraph -> Transaction -> Transaction -> Set Transaction -> Either RelationalError (Set Transaction) Source #
Search from a past graph point to all following heads for a specific transaction. If found, return the transaction path, otherwise a RelationalError.
mergeTransactions :: UTCTime -> TransactionId -> TransactionId -> MergeStrategy -> (HeadName, HeadName) -> GraphRefRelationalExprM (DisconnectedTransaction, TransactionGraph) Source #
showTransactionStructureX :: Bool -> Transaction -> TransactionGraph -> String Source #
showGraphStructureX :: Bool -> TransactionGraph -> String Source #
filterSubGraph :: TransactionGraph -> TransactionHeads -> Either RelationalError TransactionGraph Source #
After splicing out a subgraph, run it through this function to remove references to transactions which are not in the subgraph.
createUnionMergeTransaction :: UTCTime -> TransactionId -> MergeStrategy -> (Transaction, Transaction) -> GraphRefRelationalExprM Transaction Source #
lookupTransaction :: TransactionGraph -> TransactionIdLookup -> Either RelationalError Transaction Source #
traverseGraph :: TransactionGraph -> TransactionId -> [TransactionIdHeadBacktrack] -> Either RelationalError TransactionId Source #
backtrackGraph :: TransactionGraph -> TransactionId -> TransactionIdHeadBacktrack -> Either RelationalError TransactionId Source #
autoMergeToHead :: UTCTime -> (TransactionId, TransactionId, TransactionId) -> DisconnectedTransaction -> HeadName -> MergeStrategy -> TransactionGraph -> Either RelationalError (DisconnectedTransaction, TransactionGraph) Source #
Create a temporary branch for commit, merge the result to head, delete the temporary branch. This is useful to atomically commit a transaction, avoiding a TransactionIsNotHeadError but trading it for a potential MergeError. this is not a GraphOp because it combines multiple graph operations
data MerkleValidationError Source #
Instances
Generic MerkleValidationError Source # | |
Defined in ProjectM36.TransactionGraph | |
Show MerkleValidationError Source # | |
Defined in ProjectM36.TransactionGraph | |
Eq MerkleValidationError Source # | |
Defined in ProjectM36.TransactionGraph | |
type Rep MerkleValidationError Source # | |
Defined in ProjectM36.TransactionGraph type Rep MerkleValidationError = D1 ('MetaData "MerkleValidationError" "ProjectM36.TransactionGraph" "project-m36-1.0.1-inplace" 'False) (C1 ('MetaCons "MerkleValidationError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TransactionId) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MerkleHash) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MerkleHash)))) |
validateConnectivity :: TransactionGraph -> Either RelationalError TransactionGraph Source #
Ensure that referenced transactions remain in the graph.