syncer

package
v0.0.0-...-8f9f3ed Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadClient

func LoadClient(dao *daos.Dao, tenantName string) (models.IntegrationClient, error)

LoadClient loads a client depending on the config vendor.

Types

type Config

type Config struct {
	ContinueOnSyncItemError bool
}

Config contains configurable behavior flags for the syncer.

type LogHook

type LogHook struct {
	LogLevels []log.Level
	Dao       *daos.Dao
	// contains filtered or unexported fields
}

LogHook is a logrus hook that writes the logs to the database.

func (*LogHook) Fire

func (h *LogHook) Fire(entry *log.Entry) error

func (*LogHook) Levels

func (h *LogHook) Levels() []log.Level

Levels define on which log levels this hook would trigger

type Syncer

type Syncer struct {
	TenantGroupName string
	Dao             *daos.Dao
	Tenants         map[string]models.IntegrationClient
	IntentTenant    models.IntegrationClient
	Config          Config
	Logger          *log.Logger
}

Syncer orchestrates how to sync items across multiple tenants.

func NewSyncer

func NewSyncer(dao *daos.Dao, tenantGroupName string) (*Syncer, error)

NewSyncer creates a new syncer instance.

func (*Syncer) CollectAllItems

func (s *Syncer) CollectAllItems() error

CollectAllItems collects and saves fresh item details from each of the registered tenants for the syncer.

func (*Syncer) RefreshCredentials

func (s *Syncer) RefreshCredentials() error

func (*Syncer) Start

func (s *Syncer) Start() error

Start starts the syncer's background service.

func (*Syncer) SyncItem

func (s *Syncer) SyncItem(sellerSKU string) error

SyncItem tries to sync a single seller sku across all tenants.

Jump to

Keyboard shortcuts

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