sync

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEventTypeCreate = iota
	DefaultEventTypeModify = 1
	DefaultEventTypeDelete = 2
	DefaultEventTypeReady  = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cron added in v0.0.6

type Cron interface {
	AddFunc(spec string, cmd func()) error
	Start()
}

Cron defines the behaviour required of a cron

type DefaultEventType added in v0.0.5

type DefaultEventType int32

type Event

type Event[T any] struct {
	EventType T
}

Event is a struct that represents a single event. It is a generic struct that can be cast to a more specific struct.

type FilePathSync

type FilePathSync struct {
	URI          string
	Logger       *log.Entry
	ProviderArgs ProviderArgs
}

func (*FilePathSync) Fetch

func (fs *FilePathSync) Fetch(_ context.Context) (string, error)

func (*FilePathSync) Notify

func (fs *FilePathSync) Notify(ctx context.Context, w chan<- INotify)

func (*FilePathSync) Source added in v0.2.2

func (fs *FilePathSync) Source() string

type HTTPClient added in v0.0.6

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient defines the behaviour required of a http client

type HTTPSync added in v0.0.3

type HTTPSync struct {
	URI          string
	Client       HTTPClient
	Cron         Cron
	BearerToken  string
	LastBodySHA  string
	Logger       *log.Entry
	ProviderArgs ProviderArgs
}

func (*HTTPSync) Fetch added in v0.0.3

func (fs *HTTPSync) Fetch(ctx context.Context) (string, error)

func (*HTTPSync) Notify added in v0.0.3

func (fs *HTTPSync) Notify(ctx context.Context, w chan<- INotify)

func (*HTTPSync) Source added in v0.2.2

func (fs *HTTPSync) Source() string

type INotify

type INotify interface {
	GetEvent() Event[DefaultEventType]
}

type ISync

type ISync interface {
	Fetch(ctx context.Context) (string, error)
	Notify(ctx context.Context, c chan<- INotify)
	Source() string
}

type Notifier

type Notifier struct {
	Event Event[DefaultEventType]
}

func (*Notifier) GetEvent

func (w *Notifier) GetEvent() Event[DefaultEventType]

type ProviderArgs added in v0.1.0

type ProviderArgs map[string]string

Directories

Path Synopsis
Package syncmock is a generated GoMock package.
Package syncmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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