images

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 53 Imported by: 0

Documentation

Overview

Package images implements the durable EVE-KILL image surface.

Index

Constants

View Source
const (
	TurtleToolsRepository = "SentientTurtle/EVE-TurtleTools"
	TurtleTypeExportAsset = "Image.Export.Collection.zip"
)
View Source
const (
	OldCharacterArchiveURL = "https://data.everef.net/ccp/portraits/OldCharPortraits_256.zip"
)

Variables

This section is empty.

Functions

func Register

func Register(a huma.API, service *Service)

Register adds the canonical /images namespace to the shared Huma document.

Types

type Cache

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

Cache is the serve-only, byte-bounded LRU for final encoded responses. Values are immutable after insertion, so a hit can be written directly to the response without another allocation proportional to the image size.

func NewCache

func NewCache(maxBytes int64, ttl time.Duration) *Cache

func (*Cache) Get

func (c *Cache) Get(key string) (Result, bool)

func (*Cache) Put

func (c *Cache) Put(key string, value Result)

func (*Cache) RemovePrefix

func (c *Cache) RemovePrefix(prefix string)

func (*Cache) Stats

func (c *Cache) Stats() CacheStats

type CacheStats

type CacheStats struct {
	Entries int
	Bytes   int64
	Maximum int64
	Hits    uint64
	Misses  uint64
}

type Error

type Error struct {
	Status  int
	Message string
	Err     error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ImportOptions

type ImportOptions struct {
	Concurrency      int
	CacheDirectory   string
	Force            bool
	Progress         func(ImportResult)
	DownloadProgress func(completed, total int64)
}

type ImportResult

type ImportResult struct {
	Scanned  int64 `json:"scanned"`
	Uploaded int64 `json:"uploaded"`
	Skipped  int64 `json:"skipped"`
	Bytes    int64 `json:"bytes"`
}

func GenerateMapImages added in v0.1.5

func GenerateMapImages(ctx context.Context, db MapDatabase, store ObjectStore, options MapGenerateOptions) (ImportResult, error)

func ImportBundledStatic added in v0.1.5

func ImportBundledStatic(ctx context.Context, store ObjectStore, options ImportOptions) (ImportResult, error)

ImportBundledStatic imports the UI, Dust 514, and overlay assets shipped in the Shrike binary. Map images are generated from PostgreSQL separately.

func ImportOldCharacters

func ImportOldCharacters(
	ctx context.Context,
	store ObjectStore,
	source string,
	client *http.Client,
	options ImportOptions,
) (ImportResult, error)

ImportOldCharacters downloads or opens the static EVE Ref archive and uploads individual portraits. Remote archives are kept in CacheDirectory and resumed with HTTP Range requests. B2 completion markers are published after each two-digit shard, so a restart neither probes every object nor repeats more than the interrupted shard.

func ImportStaticTree

func ImportStaticTree(
	ctx context.Context,
	store ObjectStore,
	root string,
	options ImportOptions,
) (ImportResult, error)

ImportStaticTree uploads the checked-in image-server assets that are not supplied by the TurtleTools release: maps, UI icons, Dust 514 images, and overlay definitions.

type MapDatabase added in v0.1.5

type MapDatabase interface {
	Query(context.Context, string, ...any) (pgx.Rows, error)
}

type MapGenerateOptions added in v0.1.5

type MapGenerateOptions struct {
	Kind        MapKind
	ID          int64
	Limit       int
	Size        int
	Sizes       []int
	Concurrency int
	Started     func(kind MapKind, id, current, total int64)
	Progress    func(done, total int64)
}

type MapKind added in v0.1.5

type MapKind string
const (
	MapSystem        MapKind = "system"
	MapConstellation MapKind = "constellation"
	MapRegion        MapKind = "region"
)

type ObjectStore

type ObjectStore interface {
	GetObject(context.Context, string) (*objectstore.Object, error)
	Stat(context.Context, string) (*objectstore.ObjectInfo, error)
	PutWithOptions(context.Context, string, []byte, objectstore.PutOptions) error
	Delete(context.Context, string) error
}

type Options

type Options struct {
	Store       ObjectStore
	Social      SocialLoader
	HTTPClient  *http.Client
	UserAgent   string
	CacheBytes  int64
	CacheTTL    time.Duration
	Now         func() time.Time
	UpstreamURL string
}

type PostgresSocialLoader

type PostgresSocialLoader struct {
	DB SocialDatabase
}

func (PostgresSocialLoader) LoadKillmailSocial

func (l PostgresSocialLoader) LoadKillmailSocial(
	ctx context.Context,
	id int64,
) (SocialKillmail, bool, error)

type Result

type Result struct {
	Body         []byte
	ContentType  string
	ETag         string
	LastModified time.Time
	CacheControl string
}

type Service

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

func New

func New(options Options) *Service

func (*Service) Available

func (s *Service) Available() bool

func (*Service) CacheStats

func (s *Service) CacheStats() CacheStats

func (*Service) KillmailSocial

func (s *Service) KillmailSocial(
	ctx context.Context,
	id int64,
) (Result, error)

func (*Service) OldCharacter

func (s *Service) OldCharacter(
	ctx context.Context,
	id int64,
	size int,
	format string,
) (Result, error)

func (*Service) Static

func (s *Service) Static(
	ctx context.Context,
	category string,
	name string,
	size int,
	format string,
) (Result, error)

func (*Service) Type

func (s *Service) Type(
	ctx context.Context,
	id int64,
	variant string,
	size int,
	format string,
) (Result, error)

type SocialDatabase

type SocialDatabase interface {
	QueryRow(context.Context, string, ...any) pgx.Row
}

type SocialKillmail

type SocialKillmail struct {
	TotalValue      float64
	SolarSystemName string
	RegionName      string
	Victim          SocialParty
	FinalBlow       *SocialParty
}

type SocialLoader

type SocialLoader interface {
	LoadKillmailSocial(context.Context, int64) (SocialKillmail, bool, error)
}

SocialLoader owns the database lookup so rendering stays testable without a live Postgres instance.

type SocialParty

type SocialParty struct {
	CharacterID     int64
	CharacterName   string
	CorporationID   int64
	CorporationName string
	AllianceID      int64
	AllianceName    string
	ShipTypeID      int64
	ShipName        string
}

type TypeExportSyncOptions

type TypeExportSyncOptions struct {
	HTTPClient  *http.Client
	Token       string
	UserAgent   string
	APIURL      string
	Archive     string
	Concurrency int
	Progress    func(ImportResult)
	Now         func() time.Time
}

type TypeExportSyncResult

type TypeExportSyncResult struct {
	Release string       `json:"release"`
	Digest  string       `json:"digest"`
	Changed bool         `json:"changed"`
	Import  ImportResult `json:"import"`
}

func SyncTypeExport

func SyncTypeExport(
	ctx context.Context,
	store ObjectStore,
	options TypeExportSyncOptions,
) (TypeExportSyncResult, error)

Jump to

Keyboard shortcuts

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