dealpusher

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0, MIT Imports: 18 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) (*DealPusher, error)

func (*DealPusher) Name

func (*DealPusher) Name() string

func (*DealPusher) Start

func (d *DealPusher) Start(ctx context.Context) ([]service.Done, service.Fail, 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.

Returns:

  • A slice of channels that the caller can select on to wait for the service to stop.
  • A channel for errors that may occur while the service is running.
  • 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