synchronization

package
v0.0.0-...-0cd0346 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store[SourceItem any, PoolItem any] interface {
	SourceList(ctx context.Context) ([]SourceItem, error)
	SourceExists(ctx context.Context, s []SourceItem, p PoolItem) bool

	PoolList(ctx context.Context) []PoolItem
	PoolExists(ctx context.Context, s SourceItem) bool
	PoolInsert(ctx context.Context, s SourceItem)
	PoolUpdate(ctx context.Context, s PoolItem)
	PoolRemove(ctx context.Context, s PoolItem)
}

type Synchronize

type Synchronize[SourceItem any, PoolItem any] struct {
	// contains filtered or unexported fields
}

Synchronize is a generic type that provides methods for synchronizing a pool of items with a source. It uses a Store interface to interact with the source and pool, allowing for flexible synchronization logic.

func NewSynchronize

func NewSynchronize[SourceItem any, PoolItem any](spanPrefix string, logsPrefix string, store Store[SourceItem, PoolItem]) *Synchronize[SourceItem, PoolItem]

func (*Synchronize[SourceItem, PoolItem]) Close

func (s *Synchronize[SourceItem, PoolItem]) Close()

func (*Synchronize[SourceItem, PoolItem]) Start

func (s *Synchronize[SourceItem, PoolItem]) Start(ctx context.Context, syncInterval time.Duration, syncRoundTimeout time.Duration, runInitialSync bool)

func (*Synchronize[SourceItem, PoolItem]) Sync

func (s *Synchronize[SourceItem, PoolItem]) Sync(ctx context.Context) error

Sync performs periodic sync or it can be done as an on-demand synchronization round against the source.

Jump to

Keyboard shortcuts

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