repositories

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProbeQueueIsEmpty = errors.New("queue is empty")
	ErrProbeIsNotReady   = errors.New("queue has waiting probes")
	ErrProbeHasExpired   = errors.New("probe has expired")
)
View Source
var (
	ErrServerNotFound = errors.New("the requested server was not found")
	ErrServerExists   = errors.New("server already exists")
)
View Source
var ErrInstanceNotFound = errors.New("the requested instance was not found")
View Source
var NC = time.Time{} // no constraint

Functions

func ServerOnConflictIgnore

func ServerOnConflictIgnore(_ *server.Server) bool

Types

type InstanceRepository

type InstanceRepository interface {
	Add(context.Context, instance.Instance) error
	GetByID(context.Context, string) (instance.Instance, error)
	GetByAddr(context.Context, addr.Addr) (instance.Instance, error)
	RemoveByID(context.Context, string) error
	RemoveByAddr(context.Context, addr.Addr) error
	Count(context.Context) (int, error)
}

type ProbeRepository

type ProbeRepository interface {
	Add(context.Context, probe.Probe) error
	AddBetween(context.Context, probe.Probe, time.Time, time.Time) error
	Pop(context.Context) (probe.Probe, error)
	PopAny(context.Context) (probe.Probe, error)
	PopMany(context.Context, int) ([]probe.Probe, int, error)
	Count(context.Context) (int, error)
}

type ServerRepository

type ServerRepository interface {
	Get(ctx context.Context, addr addr.Addr) (server.Server, error)
	Add(ctx context.Context, server server.Server, onConflict func(*server.Server) bool) (server.Server, error)
	Update(ctx context.Context, server server.Server, onConflict func(*server.Server) bool) (server.Server, error)
	AddOrUpdate(ctx context.Context, server server.Server, onConflict func(*server.Server)) (server.Server, error)
	Remove(ctx context.Context, server server.Server, onConflict func(*server.Server) bool) error
	Filter(ctx context.Context, fs filterset.FilterSet) ([]server.Server, error)
	Count(ctx context.Context) (int, error)
	CountByStatus(ctx context.Context) (map[ds.DiscoveryStatus]int, error)
}

Jump to

Keyboard shortcuts

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