loader

package
v0.0.0-...-ab3c899 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler loads promotions from a source file into a data storage

func NewLoader

func NewLoader(
	cfg *config.Config, ctx context.Context, swp WriterProvider, src Source, lc Lifecycle,
) *Handler

NewLoader initiates a new instance of Handler

func (*Handler) Load

func (p *Handler) Load() (int64, error)

Load loads promotions from a source into a data storage

type Lifecycle

type Lifecycle interface {
	OnFinish(filename string) error
}

Lifecycle exposes hooks to load process

func NewLifecycle

func NewLifecycle() Lifecycle

type Source

type Source interface {
	File(filename string) (*os.File, error)
}

Source abstracts promotions file source loading

func NewSource

func NewSource() Source

type Streamer

type Streamer interface {
	Stream(w io.Writer, chunk []string) error
}

Streamer handles promotions file data chunks

func NewStreamer

func NewStreamer() Streamer

type Writer

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

func (*Writer) Close

func (rw *Writer) Close() error

func (*Writer) Write

func (rw *Writer) Write(chunk []byte) (int, error)

type WriterProvider

type WriterProvider func() (io.WriteCloser, error)

func RedisWriterFn

func RedisWriterFn(cfg *config.Config) WriterProvider

Jump to

Keyboard shortcuts

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