dealpusher

package
v0.5.14 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = log.Logger("dealpusher")

Functions

This section is empty.

Types

type DealPusher

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

DealPusher represents a struct that encapsulates the data and functionality related to pushing deals in a replication process.

func NewDealPusher

func NewDealPusher(db *gorm.DB, lotusURL string,
	lotusToken string, numAttempts uint, maxReplicas uint) (*DealPusher, error)

func (*DealPusher) Name

func (*DealPusher) Name() string

func (*DealPusher) Start

func (d *DealPusher) Start(ctx context.Context, exitErr chan<- error) error

Start initializes and starts the DealPusher service.

It first attempts to register the worker with the health check system. If another worker is already running, it waits and retries until it can register or the context is cancelled. Once registered, it launches three main activities in separate goroutines:

  1. Reporting its health status.
  2. Running the deal processing loop.
  3. Handling cleanup when the service is stopped.

Parameters:

  • ctx : The context for managing the lifecycle of the Start function. If Done, the function exits cleanly.
  • exitErr : A channel for an error or nil when the service exits

Returns:

  • An error if there was a problem starting the service.

This function is intended to be called once at the start of the service lifecycle.

Jump to

Keyboard shortcuts

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