stream

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TargetTypeStdout = "stdout"
	TargetTypeNop    = "nop"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry manages registered stream targets.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new stream target registry.

func (*Registry) All

func (r *Registry) All() []corestream.Target

All returns all registered targets.

func (*Registry) Enabled

func (r *Registry) Enabled() []corestream.Target

Enabled returns all enabled targets.

func (*Registry) Get

func (r *Registry) Get(name string) (corestream.Target, bool)

Get retrieves a target by name.

func (*Registry) Register

func (r *Registry) Register(target corestream.Target)

Register adds a target to the registry.

type SyncOption added in v0.3.2

type SyncOption func(*syncOptions)

SyncOption configures sync behavior.

func WithBatchSize added in v0.3.2

func WithBatchSize(size int) SyncOption

WithBatchSize sets the number of events and audits to fetch per iteration. A value of 0 uses the Syncer's default batch size.

func WithIterations added in v0.3.2

func WithIterations(n int) SyncOption

WithIterations sets the maximum number of batch iterations. A value of 0 means unlimited (drain all pending items).

func WithProgressCallback added in v0.3.2

func WithProgressCallback(fn func(SyncProgress)) SyncOption

WithProgressCallback sets a callback for progress updates.

type SyncProgress added in v0.3.2

type SyncProgress struct {
	TargetName string
	EventsSent int
	AuditsSent int
	IsComplete bool
}

SyncProgress reports progress during sync.

type SyncResult

type SyncResult struct {
	TargetResults []TargetSyncResult
}

SyncResult holds the overall result of a sync operation.

type Syncer

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

Syncer orchestrates syncing events and self-audits to stream targets.

func NewSyncer

func NewSyncer(store storage.Store, registry *Registry) *Syncer

NewSyncer creates a new Syncer.

func (*Syncer) Sync

func (s *Syncer) Sync(ctx context.Context, opts ...SyncOption) (*SyncResult, error)

Sync sends unsent events and self-audits to all enabled targets.

type TargetSyncResult

type TargetSyncResult struct {
	TargetName string
	EventsSent int
	AuditsSent int
	Error      error
}

TargetSyncResult holds the result for a single target.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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