sync

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

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
}

func (*FilePathSync) Fetch

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

func (*FilePathSync) Notify

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

type HTTPSync added in v0.0.3

type HTTPSync struct {
	URI         string
	Client      *http.Client
	BearerToken string
	LastBodySHA string
	Logger      *log.Entry
}

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)

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)
}

ISync implementations watch for changes in the flag source (HTTP backend, local file, s3 bucket), and fetch the latest values.

type Notifier

type Notifier struct {
	Event Event[DefaultEventType]
}

func (*Notifier) GetEvent

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

Jump to

Keyboard shortcuts

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