mysqlstore

package
Version: v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package mysqlstore provides a mysql store implementation for sagas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrations

func Migrations(conn string) []*otgorm.Migration

Migrations returns the database migrations needed for MySQLStore.

func Providers

func Providers() di.Deps

Providers returns MySQLStore dependency.

DependsOn:
	- otgorm.Maker
	- contract.ConfigAccessor
Provides:
	- *MySQLStore
	- sagas.Store

Types

type MySQLStore

type MySQLStore struct {
	// contains filtered or unexported fields
}

MySQLStore is a Store implementation for sagas.

func New

func New(db *gorm.DB, opts ...Option) *MySQLStore

New returns a pointer to MySQLStore.

func (*MySQLStore) Ack

func (s *MySQLStore) Ack(ctx context.Context, id string, err error) error

Ack acknowledges a transaction step is completed.

func (*MySQLStore) CleanUp

func (s *MySQLStore) CleanUp(ctx context.Context) error

CleanUp periodically removes the logs that exceed their of maximum retention.

func (*MySQLStore) Log

func (s *MySQLStore) Log(ctx context.Context, log sagas.Log) error

Log appends the log to mysql store.

func (*MySQLStore) UnacknowledgedSteps

func (s *MySQLStore) UnacknowledgedSteps(ctx context.Context, correlationID string) ([]sagas.Log, error)

UnacknowledgedSteps returns all unacknowledged steps from the store. Those steps are up for rollback.

func (*MySQLStore) UncommittedSagas

func (s *MySQLStore) UncommittedSagas(ctx context.Context) ([]sagas.Log, error)

UncommittedSagas searches all uncommitted sagas and returns unacknowledged steps from those sagas.

type Option

type Option func(store *MySQLStore)

Option is the type for MySQLStore options.

func WithCleanUpInterval

func WithCleanUpInterval(duration time.Duration) Option

WithCleanUpInterval is the option that sets the clean up interval.

func WithRetention

func WithRetention(duration time.Duration) Option

WithRetention is the option that sets the maximum log retention after which the log will be cleared.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL