Help us shape the future of Go! Take the 2026 Go Developer Survey

adminserver

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package adminserver is the network module's admin-side management of the servers and nodes: their creation, updates and removal, their sort order, the protocols a server offers and its node configuration overrides, and the node-facing caches these changes invalidate. Only the module facade may reach it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Store Store
	// Subscriptions is the subscription read port (the subscription
	// facade): the subscriptions behind the online users.
	Subscriptions OnlineSubscriptionReader
	// Config snapshots the runtime-mutable node settings per request.
	Config func() Snapshot
}

Deps declares the subdomain's dependencies; the module facade forwards them from the composition root.

type OnlineSubscriptionReader added in v1.21.0

type OnlineSubscriptionReader interface {
	SubscriptionDetailsByIDs(ctx context.Context, ids []int64) ([]*usersub.SubscribeDetails, error)
}

OnlineSubscriptionReader reads the subscriptions behind the online users, with their plans.

type Service

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

Service is the admin server-management entry point used by the network facade.

func NewService

func NewService(deps Deps) *Service

NewService returns the subdomain's service over deps.

func (*Service) ClearServerCachesByNodeScope added in v1.21.0

func (s *Service) ClearServerCachesByNodeScope(ctx context.Context, nodeIDs []int64, tags []string) error

ClearServerCachesByNodeScope drops the node-facing caches (user lists and configs) of every server carrying a node the scope selects: an explicit node id or any of the tags, whether the node is enabled or not. One query resolves the servers however many plans the scope came from; an empty scope clears nothing.

func (*Service) CreateNode

func (s *Service) CreateNode(ctx context.Context, req *dto.CreateNodeRequest) error

CreateNode stores a new node of a server.

func (*Service) CreateServer

func (s *Service) CreateServer(ctx context.Context, req *dto.CreateServerRequest) error

CreateServer stores a new server with its protocols, generating the keys the protocols need. A server given neither a country nor a city is located by its address.

func (*Service) DeleteNode

func (s *Service) DeleteNode(ctx context.Context, req *dto.DeleteNodeRequest) error

DeleteNode removes a node and drops the node-facing caches of its server.

func (*Service) DeleteServer

func (s *Service) DeleteServer(ctx context.Context, req *dto.DeleteServerRequest) error

DeleteServer removes a server together with its nodes and its node configuration override, in one network transaction, and then drops its node-facing caches. The nodes carry no foreign key to their server: left behind, they would fail every subscription render that selects them.

func (*Service) FilterNodeList

FilterNodeList lists a page of the nodes matching the search.

func (*Service) FilterServerList

FilterServerList lists a page of servers with their protocols, status and online users. The subscriptions behind every online user of the page are read in one query, not one per user.

func (*Service) GetServerNodeConfig

GetServerNodeConfig returns a server's node configuration: the global values, the server's override and the values in effect with it.

func (*Service) GetServerProtocols

GetServerProtocols returns the protocols a server offers, as the API shows them.

func (*Service) QueryNodeTag

func (s *Service) QueryNodeTag(ctx context.Context) (*dto.QueryNodeTagResponse, error)

QueryNodeTag lists every tag any node carries, once.

func (*Service) ResetSortWithNode

func (s *Service) ResetSortWithNode(ctx context.Context, req *dto.ResetSortRequest) error

ResetSortWithNode stores the node order an administrator set.

func (*Service) ResetSortWithServer

func (s *Service) ResetSortWithServer(ctx context.Context, req *dto.ResetSortRequest) error

ResetSortWithServer stores the server order an administrator set.

func (*Service) ToggleNodeStatus

func (s *Service) ToggleNodeStatus(ctx context.Context, req *dto.ToggleNodeStatusRequest) error

ToggleNodeStatus enables or disables a node and drops the node-facing caches of its server. A request without the switch keeps the stored one, by UpdateNode's rule: the column cannot be NULL.

func (*Service) UpdateNode

func (s *Service) UpdateNode(ctx context.Context, req *dto.UpdateNodeRequest) error

UpdateNode stores a node's settings and drops the node-facing caches of its server, and of the server it moved from. A request without the enabled switch keeps the stored one: the column cannot be NULL.

func (*Service) UpdateServer

func (s *Service) UpdateServer(ctx context.Context, req *dto.UpdateServerRequest) error

UpdateServer stores a server's settings and protocols and drops its node-facing caches. A protocol keeps the stored values of the fields the request left out, and its stored keys unless new ones are given.

func (*Service) UpdateServerNodeConfig

func (s *Service) UpdateServerNodeConfig(ctx context.Context, req *dto.UpdateServerNodeConfigRequest) error

UpdateServerNodeConfig stores a server's node configuration override, or removes it when every value is inherited, and drops the server's node-facing caches.

type Snapshot

type Snapshot struct {
	Node config.NodeConfig
}

Snapshot is the per-request view of the runtime-mutable node settings.

type Store added in v1.20.3

type Store interface {
	repository.NetworkTransactor
	Node() repository.NodeRepo
}

Store is the persistence capability required by this package. It excludes unrelated repositories and application-wide transactions.

Jump to

Keyboard shortcuts

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