project-m36-1.0.1: Relational Algebra Engine
Safe HaskellSafe-Inferred
LanguageHaskell2010

ProjectM36.TransactionGraph

Synopsis

Documentation

data TransactionIdLookup Source #

Record a lookup for a specific transaction in the graph.

Instances

Instances details
Generic TransactionIdLookup Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Associated Types

type Rep TransactionIdLookup :: Type -> Type Source #

Show TransactionIdLookup Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Eq TransactionIdLookup Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Serialise TransactionIdLookup Source # 
Instance details

Defined in ProjectM36.TransactionGraph

type Rep TransactionIdLookup Source # 
Instance details

Defined in ProjectM36.TransactionGraph

data TransactionIdHeadBacktrack Source #

Used for git-style head backtracking such as topic~3^2.

Constructors

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

Instances details
Generic TransactionIdHeadBacktrack Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Associated Types

type Rep TransactionIdHeadBacktrack :: Type -> Type Source #

Show TransactionIdHeadBacktrack Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Eq TransactionIdHeadBacktrack Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Serialise TransactionIdHeadBacktrack Source # 
Instance details

Defined in ProjectM36.TransactionGraph

type Rep TransactionIdHeadBacktrack Source # 
Instance details

Defined in ProjectM36.TransactionGraph

type Rep TransactionIdHeadBacktrack = D1 ('MetaData "TransactionIdHeadBacktrack" "ProjectM36.TransactionGraph" "project-m36-1.0.1-inplace" 'False) (C1 ('MetaCons "TransactionIdHeadParentBacktrack" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: (C1 ('MetaCons "TransactionIdHeadBranchBacktrack" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "TransactionStampHeadBacktrack" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime))))

data TransactionGraphOperator Source #

Operators which manipulate a transaction graph and which transaction the current Session is based upon.

Instances

Instances details
Generic TransactionGraphOperator Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Associated Types

type Rep TransactionGraphOperator :: Type -> Type Source #

Show TransactionGraphOperator Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Eq TransactionGraphOperator Source # 
Instance details

Defined in ProjectM36.TransactionGraph

Serialise TransactionGraphOperator Source # 
Instance details

Defined in ProjectM36.TransactionGraph

type Rep TransactionGraphOperator Source # 
Instance details

Defined in ProjectM36.TransactionGraph

type Rep TransactionGraphOperator = D1 ('MetaData "TransactionGraphOperator" "ProjectM36.TransactionGraph" "project-m36-1.0.1-inplace" 'False) (((C1 ('MetaCons "JumpToHead" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadName)) :+: C1 ('MetaCons "JumpToTransaction" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TransactionId))) :+: (C1 ('MetaCons "WalkBackToTime" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime)) :+: C1 ('MetaCons "Branch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadName)))) :+: ((C1 ('MetaCons "DeleteBranch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadName)) :+: C1 ('MetaCons "MergeTransactions" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MergeStrategy) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadName)))) :+: (C1 ('MetaCons "Commit" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Rollback" 'PrefixI 'False) (U1 :: Type -> Type))))

freshTransactionGraph :: DatabaseContext -> IO (TransactionGraph, TransactionId) Source #

Create a transaction graph from a context.

isRootTransaction :: Transaction -> Bool Source #

A root transaction terminates a graph and has no parents.

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.

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.

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.

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 #

validateConnectivity :: TransactionGraph -> Either RelationalError TransactionGraph Source #

Ensure that referenced transactions remain in the graph.