transaction

package
v3.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package transaction provides the public API for initializing the transaction component. This package exposes factory functions that allow other components to instantiate the transaction service while keeping internal implementation details private.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Logger allows callers to provide a pre-configured logger, avoiding multiple
	// initializations when composing components (e.g. unified ledger).
	Logger libLog.Logger
}

Options configures the transaction service initialization behavior.

type TransactionService

type TransactionService interface {
	mbootstrap.Service
	// GetBalancePort returns the balance port for use by other modules.
	// This allows direct in-process calls instead of gRPC when running in unified mode.
	// The returned BalancePort is the transaction UseCase itself.
	GetBalancePort() mbootstrap.BalancePort

	// GetMetadataIndexPort returns the metadata index repository for use by other modules.
	// This allows direct in-process calls for metadata index operations when running in unified mode.
	GetMetadataIndexPort() mbootstrap.MetadataIndexRepository

	// GetRouteRegistrar returns a function that registers transaction routes to a Fiber app.
	// This is used by the unified ledger server to consolidate all routes on a single port.
	GetRouteRegistrar() func(*fiber.App)
}

TransactionService extends mbootstrap.Service with transaction-specific functionality. This interface provides access to the BalancePort for in-process communication and route registration for unified ledger mode.

func InitService deprecated

func InitService() TransactionService

InitService initializes the transaction service.

Deprecated: Use InitServiceOrError for proper error handling. This function panics on initialization errors.

func InitServiceOrError

func InitServiceOrError() (TransactionService, error)

InitServiceOrError initializes the transaction service with explicit error handling. This is the recommended way to initialize the service as it allows callers to handle initialization errors gracefully instead of panicking.

func InitServiceWithOptionsOrError

func InitServiceWithOptionsOrError(opts *Options) (TransactionService, error)

InitServiceWithOptionsOrError initializes the transaction service with custom options and explicit error handling. Use this when composing in unified ledger mode.

Directories

Path Synopsis
Package api Code generated by swaggo/swag.
Package api Code generated by swaggo/swag.
cmd
app command
internal
adapters/mongodb
Package mongodb is a generated GoMock package.
Package mongodb is a generated GoMock package.
adapters/postgres/assetrate
Package assetrate is a generated GoMock package.
Package assetrate is a generated GoMock package.
adapters/postgres/balance
Package balance is a generated GoMock package.
Package balance is a generated GoMock package.
adapters/postgres/operation
Package operation is a generated GoMock package.
Package operation is a generated GoMock package.
adapters/postgres/operationroute
Package operationroute is a generated GoMock package.
Package operationroute is a generated GoMock package.
adapters/postgres/transaction
Package transaction is a generated GoMock package.
Package transaction is a generated GoMock package.
adapters/postgres/transactionroute
Package transactionroute is a generated GoMock package.
Package transactionroute is a generated GoMock package.
adapters/rabbitmq
Package rabbitmq is a generated GoMock package.
Package rabbitmq is a generated GoMock package.
adapters/redis
Package redis is a generated GoMock package.
Package redis is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL