Documentation ¶
Index ¶
- func New(m MODE, path string, token *Token) (*Context, Transaction, error)
- func SetIdGenerationStrategy(strategy IdGenerationStrategy)
- func SetupCredentials(ctx *Context, token *Token)
- type Context
- type DebugTransaction
- type IdGenerationStrategy
- type MODE
- type PathIdGenerationStrategy
- type SinglebranchTransaction
- type Token
- type Transaction
- type UUIDIdGenerationStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
creates a new transaction in given mode and path (must be git repo) returns a transaction context and the transaction or an error
func SetIdGenerationStrategy ¶
func SetIdGenerationStrategy(strategy IdGenerationStrategy)
set the id generation strategy which shall be used to generate the transaction ids.
func SetupCredentials ¶
setup credentials for the given transaction
Types ¶
type Context ¶
type Context struct { Id string // contains filtered or unexported fields }
The transaction context holds information about a transaction
type DebugTransaction ¶ added in v0.1.4
type DebugTransaction struct {
Transaction
}
The debug transaction abstracts a dummy transaction and might be useful for testing or deactivating some transaction while not needing to remove the implementation
func (*DebugTransaction) Commit ¶ added in v0.1.4
func (sbt *DebugTransaction) Commit(ctx *Context) error
On the debug transaction nothing will happen when calling Commit
func (*DebugTransaction) Rollback ¶ added in v0.1.4
func (sbt *DebugTransaction) Rollback(ctx *Context) error
On the debug transaction nothing will happen when calling Rollback
func (*DebugTransaction) Write ¶ added in v0.1.4
func (sbt *DebugTransaction) Write(ctx *Context) error
On the debug transaction nothing will happen when calling Write
type IdGenerationStrategy ¶
The idGenerationStrategy interface defines the abstraction for creating an id.
type MODE ¶
type MODE int
the mode defines how the transaction is executed
- SINGLEBRANCH: the transaction will be done in the currently active branch
currently only the SINGLEBRANCH option s supported.
type PathIdGenerationStrategy ¶
type PathIdGenerationStrategy struct {
IdGenerationStrategy
}
the path id generation strategy
func (*PathIdGenerationStrategy) GenerateId ¶
func (strategy *PathIdGenerationStrategy) GenerateId(path string) string
the id simply represents the path of the underlying repository
type SinglebranchTransaction ¶
type SinglebranchTransaction struct { Transaction // contains filtered or unexported fields }
The singlebranch transaction abstracts a git-transaction inside one branch and represents the most simple version of a git transaction.
func (*SinglebranchTransaction) Commit ¶
func (sbt *SinglebranchTransaction) Commit(ctx *Context) error
Commit will write commit the transaction by pushing to the defined repository.
func (*SinglebranchTransaction) Rollback ¶
func (sbt *SinglebranchTransaction) Rollback(ctx *Context) error
Rollback will reset to the state where the branch transaction started. Rollback is called if an error happens during writing or commiting a transaction
func (*SinglebranchTransaction) Write ¶
func (sbt *SinglebranchTransaction) Write(ctx *Context) error
Write will write all current changes to the transaction by creating a commit.
type Token ¶
A token represents the properties of an acccess token which are needed to allow its usage for
type Transaction ¶
type Transaction interface { Write(*Context) error Commit(*Context) error Rollback(*Context) error }
The Transaction interface defines the abstraction of a transaction
func FindTransaction ¶
func FindTransaction(ctx *Context) Transaction
returns a transaction if matching id is found, otherwise nil
type UUIDIdGenerationStrategy ¶
type UUIDIdGenerationStrategy struct {
IdGenerationStrategy
}
the UUID as id generation strategy
func (*UUIDIdGenerationStrategy) GenerateId ¶
func (strategy *UUIDIdGenerationStrategy) GenerateId(seed string) string
generates an UUID as transaction id. This id will be written in each write allowing to trace what was done inside one transaction