frontend

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(r *gin.RouterGroup, cache SpotCache, dxccClient *dxcc.Client, lotwClient *lotw.Client)

SetupRoutes configures all API endpoints

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache manages a thread-safe collection of DX spots with size limiting and timestamp ordering. If Redis is enabled, this acts as the "source of truth" after aggregation, and API queries will still filter this memory cache. For persistence + direct Redis query, we'd need a different strategy. For now, mirroring Node.js: in-memory is the primary API source, Redis for POTA dedupe.

func NewCache

func NewCache() *Cache

NewCache creates a new empty spot cache with default max size.

func (*Cache) AddSpot

func (c *Cache) AddSpot(newSpot spot.Spot) bool

AddSpot adds or updates a spot in the cache. If a spot with the same spotted callsign and frequency exists, it is updated (not duplicated). If cache exceeds max size, oldest spots are removed. Returns true if the spot was updated, false if it was added as new.

func (*Cache) GetAllSpots

func (c *Cache) GetAllSpots() []spot.Spot

GetAllSpots returns all spots in the cache, sorted by timestamp (newest first).

type SpotCache

type SpotCache interface {
	GetAllSpots() []spot.Spot
	AddSpot(newSpot spot.Spot) bool
}

SpotCache defines the interface for accessing cached spots

Jump to

Keyboard shortcuts

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