mbootstrap

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: 6 Imported by: 0

Documentation

Overview

Package mbootstrap is a generated GoMock package.

Package mbootstrap provides shared interfaces for bootstrapping Midaz components. This package enables composition of multiple components (onboarding, transaction) into a unified service (ledger) while maintaining encapsulation of internal implementations.

Package mbootstrap is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalancePort

type BalancePort interface {
	// CreateBalanceSync creates a balance synchronously and returns the created balance.
	// Named "Sync" to distinguish from the async queue-based CreateBalance in transaction module.
	CreateBalanceSync(ctx context.Context, input mmodel.CreateBalanceInput) (*mmodel.Balance, error)

	// DeleteAllBalancesByAccountID deletes all balances for a given account.
	DeleteAllBalancesByAccountID(ctx context.Context, organizationID, ledgerID, accountID uuid.UUID, requestID string) error

	// CheckHealth verifies the balance service is available.
	// In unified mode (in-process), returns nil immediately.
	// In microservices mode (gRPC), checks gRPC connection health.
	CheckHealth(ctx context.Context) error
}

BalancePort defines the interface for balance operations. This is a transport-agnostic "port" that abstracts how the onboarding module communicates with the transaction module.

This interface is implemented by:

  • transaction.UseCase: Direct implementation (unified ledger mode)
  • GRPCBalanceAdapter: Network calls via gRPC (separate services mode)

The onboarding module's UseCase depends on this port, allowing it to work with either implementation without knowing the underlying transport mechanism.

In unified ledger mode, the transaction.UseCase is passed directly to onboarding, eliminating the need for intermediate adapters and enabling zero-overhead in-process calls.

type MetadataIndexRepository

type MetadataIndexRepository interface {
	// CreateIndex creates a new index on a metadata field in the specified collection.
	// The collection parameter is the entity name (e.g., "transaction", "account").
	CreateIndex(ctx context.Context, collection string, input *mmodel.CreateMetadataIndexInput) (*mmodel.MetadataIndex, error)

	// FindAllIndexes retrieves all indexes from the specified collection.
	// Returns metadata indexes with their configuration (unique, sparse, etc.).
	FindAllIndexes(ctx context.Context, collection string) ([]*mmodel.MetadataIndex, error)

	// DeleteIndex removes an index from the specified collection.
	// The indexName should be the full MongoDB index name (e.g., "metadata.tier_1").
	DeleteIndex(ctx context.Context, collection, indexName string) error
}

MetadataIndexRepository defines the interface for metadata index operations on MongoDB. This interface is implemented by the MongoDB metadata repositories in both onboarding and transaction components, allowing direct access in unified ledger mode.

Implementations:

  • onboarding/internal/adapters/mongodb.MetadataMongoDBRepository
  • transaction/internal/adapters/mongodb.MetadataMongoDBRepository

type MockBalancePort

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

MockBalancePort is a mock of BalancePort interface.

func NewMockBalancePort

func NewMockBalancePort(ctrl *gomock.Controller) *MockBalancePort

NewMockBalancePort creates a new mock instance.

func (*MockBalancePort) CheckHealth

func (m *MockBalancePort) CheckHealth(arg0 context.Context) error

CheckHealth mocks base method.

func (*MockBalancePort) CreateBalanceSync

func (m *MockBalancePort) CreateBalanceSync(arg0 context.Context, arg1 mmodel.CreateBalanceInput) (*mmodel.Balance, error)

CreateBalanceSync mocks base method.

func (*MockBalancePort) DeleteAllBalancesByAccountID

func (m *MockBalancePort) DeleteAllBalancesByAccountID(arg0 context.Context, arg1, arg2, arg3 uuid.UUID, arg4 string) error

DeleteAllBalancesByAccountID mocks base method.

func (*MockBalancePort) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockBalancePortMockRecorder

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

MockBalancePortMockRecorder is the mock recorder for MockBalancePort.

func (*MockBalancePortMockRecorder) CheckHealth

func (mr *MockBalancePortMockRecorder) CheckHealth(arg0 any) *gomock.Call

CheckHealth indicates an expected call of CheckHealth.

func (*MockBalancePortMockRecorder) CreateBalanceSync

func (mr *MockBalancePortMockRecorder) CreateBalanceSync(arg0, arg1 any) *gomock.Call

CreateBalanceSync indicates an expected call of CreateBalanceSync.

func (*MockBalancePortMockRecorder) DeleteAllBalancesByAccountID

func (mr *MockBalancePortMockRecorder) DeleteAllBalancesByAccountID(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call

DeleteAllBalancesByAccountID indicates an expected call of DeleteAllBalancesByAccountID.

type MockMetadataIndexRepository

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

MockMetadataIndexRepository is a mock of MetadataIndexRepository interface.

func NewMockMetadataIndexRepository

func NewMockMetadataIndexRepository(ctrl *gomock.Controller) *MockMetadataIndexRepository

NewMockMetadataIndexRepository creates a new mock instance.

func (*MockMetadataIndexRepository) CreateIndex

CreateIndex mocks base method.

func (*MockMetadataIndexRepository) DeleteIndex

func (m *MockMetadataIndexRepository) DeleteIndex(arg0 context.Context, arg1, arg2 string) error

DeleteIndex mocks base method.

func (*MockMetadataIndexRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMetadataIndexRepository) FindAllIndexes

func (m *MockMetadataIndexRepository) FindAllIndexes(arg0 context.Context, arg1 string) ([]*mmodel.MetadataIndex, error)

FindAllIndexes mocks base method.

type MockMetadataIndexRepositoryMockRecorder

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

MockMetadataIndexRepositoryMockRecorder is the mock recorder for MockMetadataIndexRepository.

func (*MockMetadataIndexRepositoryMockRecorder) CreateIndex

func (mr *MockMetadataIndexRepositoryMockRecorder) CreateIndex(arg0, arg1, arg2 any) *gomock.Call

CreateIndex indicates an expected call of CreateIndex.

func (*MockMetadataIndexRepositoryMockRecorder) DeleteIndex

func (mr *MockMetadataIndexRepositoryMockRecorder) DeleteIndex(arg0, arg1, arg2 any) *gomock.Call

DeleteIndex indicates an expected call of DeleteIndex.

func (*MockMetadataIndexRepositoryMockRecorder) FindAllIndexes

func (mr *MockMetadataIndexRepositoryMockRecorder) FindAllIndexes(arg0, arg1 any) *gomock.Call

FindAllIndexes indicates an expected call of FindAllIndexes.

type Runnable

type Runnable interface {
	Run(l *libCommons.Launcher) error
}

Runnable represents a component that can be run by the launcher. This interface is compatible with libCommons.NewLauncher's RunApp function.

type RunnableConfig

type RunnableConfig struct {
	Name     string
	Runnable Runnable
}

RunnableConfig pairs a runnable with its name for the launcher.

type Service

type Service interface {
	// GetRunnables returns all runnable components of this service.
	// These will be passed to libCommons.NewLauncher for execution.
	GetRunnables() []RunnableConfig
}

Service represents a bootstrapped service that can be composed into a unified deployment. Each component (onboarding, transaction) implements this interface to expose its runnable components for composition.

Jump to

Keyboard shortcuts

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