service

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanUper added in v0.6.0

type CleanUper interface {
	CleanUp(ctx context.Context, srv domain.Server) error
}

type Ennoblement

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

func NewEnnoblement

func NewEnnoblement(repo EnnoblementRepository, client EnnoblementGetter) *Ennoblement

func (*Ennoblement) CleanUp added in v0.6.4

func (e *Ennoblement) CleanUp(ctx context.Context, srv domain.Server) error

func (*Ennoblement) ListCountWithRelations added in v0.5.5

func (e *Ennoblement) ListCountWithRelations(
	ctx context.Context,
	params domain.ListEnnoblementsParams,
) ([]domain.EnnoblementWithRelations, int64, error)

func (*Ennoblement) Refresh

func (e *Ennoblement) Refresh(ctx context.Context, key, url string) error

type EnnoblementGetter

type EnnoblementGetter interface {
	GetEnnoblements(ctx context.Context, baseURL string, since time.Time) ([]domain.BaseEnnoblement, error)
}

type EnnoblementPublisher

type EnnoblementPublisher interface {
	CmdRefresh(ctx context.Context, payloads ...domain.RefreshEnnoblementsCmdPayload) error
}

type EnnoblementRepository

type EnnoblementRepository interface {
	Create(ctx context.Context, params ...domain.CreateEnnoblementParams) error
	List(ctx context.Context, params domain.ListEnnoblementsParams) ([]domain.Ennoblement, error)
	ListCountWithRelations(
		ctx context.Context,
		params domain.ListEnnoblementsParams,
	) ([]domain.EnnoblementWithRelations, int64, error)
	Delete(ctx context.Context, serverKey string, createdAtLTE time.Time) error
}

type Job added in v0.3.0

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

func NewJob added in v0.3.0

func NewJob(
	versionSvc VersionLister,
	serverSvc ServerLister,
	serverPublisher ServerPublisher,
	ennoblementPublisher EnnoblementPublisher,
	snapshotPublisher SnapshotPublisher,
	cleaners []CleanUper,
) *Job

func (*Job) CleanUp added in v0.6.0

func (j *Job) CleanUp(ctx context.Context) error

func (*Job) CreateSnapshots added in v0.3.0

func (j *Job) CreateSnapshots(ctx context.Context) error

func (*Job) UpdateData added in v0.3.0

func (j *Job) UpdateData(ctx context.Context) error

func (*Job) UpdateEnnoblements added in v0.3.0

func (j *Job) UpdateEnnoblements(ctx context.Context) error

type OpenServerConfigInfoGetter

type OpenServerConfigInfoGetter interface {
	GetOpenServers(ctx context.Context, baseURL string) ([]domain.OpenServer, error)
	GetServerConfig(ctx context.Context, baseURL string) (domain.ServerConfig, error)
	GetBuildingInfo(ctx context.Context, baseURL string) (domain.BuildingInfo, error)
	GetUnitInfo(ctx context.Context, baseURL string) (domain.UnitInfo, error)
}

type Player

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

func NewPlayer

func NewPlayer(repo PlayerRepository, tribeChangeSvc TribeChangeCreator, client PlayerGetter) *Player

func (*Player) GetByServerKeyAndIDWithRelations added in v0.5.5

func (p *Player) GetByServerKeyAndIDWithRelations(ctx context.Context, serverKey string, id int64) (domain.PlayerWithRelations, error)

func (*Player) List

func (p *Player) List(ctx context.Context, params domain.ListPlayersParams) ([]domain.Player, error)

func (*Player) ListCountWithRelations added in v0.5.5

func (p *Player) ListCountWithRelations(ctx context.Context, params domain.ListPlayersParams) ([]domain.PlayerWithRelations, int64, error)

func (*Player) Refresh

func (p *Player) Refresh(ctx context.Context, key, url string) (int64, error)

type PlayerGetter

type PlayerGetter interface {
	GetPlayers(ctx context.Context, baseURL string) ([]domain.BasePlayer, error)
}

type PlayerLister added in v0.3.0

type PlayerLister interface {
	List(ctx context.Context, params domain.ListPlayersParams) ([]domain.Player, error)
}

type PlayerRepository

type PlayerRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreatePlayerParams) error
	Delete(ctx context.Context, serverKey string, ids ...int64) error
	List(ctx context.Context, params domain.ListPlayersParams) ([]domain.Player, error)
	ListCountWithRelations(ctx context.Context, params domain.ListPlayersParams) ([]domain.PlayerWithRelations, int64, error)
}

type PlayerSnapshot added in v0.3.0

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

func NewPlayerSnapshot added in v0.3.0

func NewPlayerSnapshot(repo PlayerSnapshotRepository, playerSvc PlayerLister) *PlayerSnapshot

func (*PlayerSnapshot) CleanUp added in v0.6.0

func (p *PlayerSnapshot) CleanUp(ctx context.Context, srv domain.Server) error

func (*PlayerSnapshot) Create added in v0.3.0

func (p *PlayerSnapshot) Create(ctx context.Context, key string, date time.Time) error

func (*PlayerSnapshot) ListCountWithRelations added in v0.7.0

type PlayerSnapshotRepository added in v0.3.0

type PlayerSnapshotRepository interface {
	Create(ctx context.Context, params ...domain.CreatePlayerSnapshotParams) error
	ListCountWithRelations(ctx context.Context, params domain.ListPlayerSnapshotsParams) ([]domain.PlayerSnapshotWithRelations, int64, error)
	Delete(ctx context.Context, serverKey string, createdAtLTE time.Time) error
}

type Server

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

func NewServer

func NewServer(repo ServerRepository, client OpenServerConfigInfoGetter) *Server

func (*Server) GetNormalByVersionCodeAndKey

func (s *Server) GetNormalByVersionCodeAndKey(ctx context.Context, versionCode, key string) (domain.Server, error)

func (*Server) List

func (s *Server) List(ctx context.Context, params domain.ListServersParams) ([]domain.Server, error)

func (*Server) ListCount added in v0.5.5

func (s *Server) ListCount(ctx context.Context, params domain.ListServersParams) ([]domain.Server, int64, error)

func (*Server) Refresh

func (s *Server) Refresh(ctx context.Context, url, versionCode string) ([]domain.Server, error)

func (*Server) UpdateEnnoblementDataUpdatedAt added in v0.6.2

func (s *Server) UpdateEnnoblementDataUpdatedAt(ctx context.Context, key string) error

func (*Server) UpdateInfoAndConfig

func (s *Server) UpdateInfoAndConfig(ctx context.Context, key, url string) error

func (*Server) UpdateNumPlayers

func (s *Server) UpdateNumPlayers(ctx context.Context, key string, numPlayers int64) error

func (*Server) UpdateNumTribes

func (s *Server) UpdateNumTribes(ctx context.Context, key string, numTribes int64) error

func (*Server) UpdateNumVillages

func (s *Server) UpdateNumVillages(ctx context.Context, key string, res domain.RefreshVillagesResult) error

func (*Server) UpdatePlayerSnapshotsCreatedAt added in v0.3.0

func (s *Server) UpdatePlayerSnapshotsCreatedAt(ctx context.Context, key string) error

func (*Server) UpdateTribeSnapshotsCreatedAt added in v0.3.0

func (s *Server) UpdateTribeSnapshotsCreatedAt(ctx context.Context, key string) error

type ServerLister

type ServerLister interface {
	List(ctx context.Context, params domain.ListServersParams) ([]domain.Server, error)
}

type ServerPublisher

type ServerPublisher interface {
	CmdRefresh(ctx context.Context, payloads ...domain.RefreshServersCmdPayload) error
}

type ServerRepository

type ServerRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreateServerParams) ([]domain.Server, error)
	List(ctx context.Context, params domain.ListServersParams) ([]domain.Server, error)
	ListCount(ctx context.Context, params domain.ListServersParams) ([]domain.Server, int64, error)
	Update(ctx context.Context, key string, params domain.UpdateServerParams) (domain.Server, error)
}

type SnapshotPublisher added in v0.3.0

type SnapshotPublisher interface {
	CmdCreatePlayers(ctx context.Context, payloads ...domain.CreateSnapshotsCmdPayload) error
	CmdCreateTribes(ctx context.Context, payloads ...domain.CreateSnapshotsCmdPayload) error
}

type Tribe

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

func NewTribe

func NewTribe(repo TribeRepository, client TribeGetter) *Tribe

func (*Tribe) GetByServerKeyAndID

func (t *Tribe) GetByServerKeyAndID(ctx context.Context, serverKey string, id int64) (domain.Tribe, error)

func (*Tribe) List

func (t *Tribe) List(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, error)

func (*Tribe) ListCount added in v0.5.5

func (t *Tribe) ListCount(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, int64, error)

func (*Tribe) Refresh

func (t *Tribe) Refresh(ctx context.Context, key, url string) (int64, error)

func (*Tribe) UpdateDominance

func (t *Tribe) UpdateDominance(ctx context.Context, serverKey string, numPlayerVillages int64) error

type TribeChange added in v0.4.0

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

func NewTribeChange added in v0.4.0

func NewTribeChange(repo TribeChangeRepository) *TribeChange

func (*TribeChange) Create added in v0.4.0

func (t *TribeChange) Create(ctx context.Context, params ...domain.CreateTribeChangeParams) error

func (*TribeChange) ListCountWithRelations added in v0.7.5

func (t *TribeChange) ListCountWithRelations(
	ctx context.Context,
	params domain.ListTribeChangesParams,
) ([]domain.TribeChangeWithRelations, int64, error)

type TribeChangeCreator added in v0.4.0

type TribeChangeCreator interface {
	Create(ctx context.Context, params ...domain.CreateTribeChangeParams) error
}

type TribeChangeRepository added in v0.4.0

type TribeChangeRepository interface {
	Create(ctx context.Context, params ...domain.CreateTribeChangeParams) error
	ListCountWithRelations(ctx context.Context, params domain.ListTribeChangesParams) ([]domain.TribeChangeWithRelations, int64, error)
}

type TribeGetter

type TribeGetter interface {
	GetTribes(ctx context.Context, baseURL string) ([]domain.BaseTribe, error)
}

type TribeLister added in v0.3.0

type TribeLister interface {
	List(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, error)
}

type TribeRepository

type TribeRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreateTribeParams) error
	UpdateDominance(ctx context.Context, serverKey string, numVillages int64) error
	Delete(ctx context.Context, serverKey string, ids ...int64) error
	List(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, error)
	ListCount(ctx context.Context, params domain.ListTribesParams) ([]domain.Tribe, int64, error)
}

type TribeSnapshot added in v0.3.0

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

func NewTribeSnapshot added in v0.3.0

func NewTribeSnapshot(repo TribeSnapshotRepository, tribeSvc TribeLister) *TribeSnapshot

func (*TribeSnapshot) CleanUp added in v0.6.0

func (t *TribeSnapshot) CleanUp(ctx context.Context, srv domain.Server) error

func (*TribeSnapshot) Create added in v0.3.0

func (t *TribeSnapshot) Create(ctx context.Context, key string, date time.Time) error

func (*TribeSnapshot) ListCount added in v0.10.0

type TribeSnapshotRepository added in v0.3.0

type TribeSnapshotRepository interface {
	Create(ctx context.Context, params ...domain.CreateTribeSnapshotParams) error
	ListCount(ctx context.Context, params domain.ListTribeSnapshotsParams) ([]domain.TribeSnapshot, int64, error)
	Delete(ctx context.Context, serverKey string, createdAtLTE time.Time) error
}

type Version

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

func NewVersion

func NewVersion(repo VersionRepository) *Version

func (*Version) GetByCode

func (v *Version) GetByCode(ctx context.Context, code string) (domain.Version, error)

func (*Version) List

func (v *Version) List(ctx context.Context) ([]domain.Version, error)

func (*Version) ListCount added in v0.5.5

func (v *Version) ListCount(ctx context.Context) ([]domain.Version, int64, error)

type VersionLister

type VersionLister interface {
	List(ctx context.Context) ([]domain.Version, error)
}

type VersionRepository

type VersionRepository interface {
	List(ctx context.Context) ([]domain.Version, error)
	ListCount(ctx context.Context) ([]domain.Version, int64, error)
	GetByCode(ctx context.Context, code string) (domain.Version, error)
}

type Village

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

func NewVillage

func NewVillage(repo VillageRepository, client VillageGetter) *Village

func (*Village) GetByServerKeyAndIDWithRelations added in v0.5.5

func (v *Village) GetByServerKeyAndIDWithRelations(ctx context.Context, serverKey string, id int64) (domain.VillageWithRelations, error)

func (*Village) ListCountWithRelations added in v0.5.5

func (v *Village) ListCountWithRelations(ctx context.Context, params domain.ListVillagesParams) ([]domain.VillageWithRelations, int64, error)

func (*Village) Refresh

func (v *Village) Refresh(ctx context.Context, key, url string) (domain.RefreshVillagesResult, error)

type VillageGetter

type VillageGetter interface {
	GetVillages(ctx context.Context, baseURL string) ([]domain.BaseVillage, error)
}

type VillageRepository

type VillageRepository interface {
	CreateOrUpdate(ctx context.Context, params ...domain.CreateVillageParams) error
	List(ctx context.Context, params domain.ListVillagesParams) ([]domain.Village, error)
	ListCountWithRelations(ctx context.Context, params domain.ListVillagesParams) ([]domain.VillageWithRelations, int64, error)
}

Jump to

Keyboard shortcuts

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