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 ¶
- type Deps
- type OnlineSubscriptionReader
- type Service
- func (s *Service) ClearServerCachesByNodeScope(ctx context.Context, nodeIDs []int64, tags []string) error
- func (s *Service) CreateNode(ctx context.Context, req *dto.CreateNodeRequest) error
- func (s *Service) CreateServer(ctx context.Context, req *dto.CreateServerRequest) error
- func (s *Service) DeleteNode(ctx context.Context, req *dto.DeleteNodeRequest) error
- func (s *Service) DeleteServer(ctx context.Context, req *dto.DeleteServerRequest) error
- func (s *Service) FilterNodeList(ctx context.Context, req *dto.FilterNodeListRequest) (*dto.FilterNodeListResponse, error)
- func (s *Service) FilterServerList(ctx context.Context, req *dto.FilterServerListRequest) (*dto.FilterServerListResponse, error)
- func (s *Service) GetServerNodeConfig(ctx context.Context, req *dto.GetServerNodeConfigRequest) (*dto.GetServerNodeConfigResponse, error)
- func (s *Service) GetServerProtocols(ctx context.Context, req *dto.GetServerProtocolsRequest) (*dto.GetServerProtocolsResponse, error)
- func (s *Service) QueryNodeTag(ctx context.Context) (*dto.QueryNodeTagResponse, error)
- func (s *Service) ResetSortWithNode(ctx context.Context, req *dto.ResetSortRequest) error
- func (s *Service) ResetSortWithServer(ctx context.Context, req *dto.ResetSortRequest) error
- func (s *Service) ToggleNodeStatus(ctx context.Context, req *dto.ToggleNodeStatusRequest) error
- func (s *Service) UpdateNode(ctx context.Context, req *dto.UpdateNodeRequest) error
- func (s *Service) UpdateServer(ctx context.Context, req *dto.UpdateServerRequest) error
- func (s *Service) UpdateServerNodeConfig(ctx context.Context, req *dto.UpdateServerNodeConfigRequest) error
- type Snapshot
- type Store
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 ¶
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 ¶
CreateNode stores a new node of a server.
func (*Service) CreateServer ¶
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 ¶
DeleteNode removes a node and drops the node-facing caches of its server.
func (*Service) DeleteServer ¶
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 ¶
func (s *Service) FilterNodeList(ctx context.Context, req *dto.FilterNodeListRequest) (*dto.FilterNodeListResponse, error)
FilterNodeList lists a page of the nodes matching the search.
func (*Service) FilterServerList ¶
func (s *Service) FilterServerList(ctx context.Context, req *dto.FilterServerListRequest) (*dto.FilterServerListResponse, error)
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 ¶
func (s *Service) GetServerNodeConfig(ctx context.Context, req *dto.GetServerNodeConfigRequest) (*dto.GetServerNodeConfigResponse, error)
GetServerNodeConfig returns a server's node configuration: the global values, the server's override and the values in effect with it.
func (*Service) GetServerProtocols ¶
func (s *Service) GetServerProtocols(ctx context.Context, req *dto.GetServerProtocolsRequest) (*dto.GetServerProtocolsResponse, error)
GetServerProtocols returns the protocols a server offers, as the API shows them.
func (*Service) QueryNodeTag ¶
QueryNodeTag lists every tag any node carries, once.
func (*Service) ResetSortWithNode ¶
ResetSortWithNode stores the node order an administrator set.
func (*Service) ResetSortWithServer ¶
ResetSortWithServer stores the server order an administrator set.
func (*Service) ToggleNodeStatus ¶
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 ¶
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 ¶
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.
Source Files
¶
- clear_node_scope_caches.go
- create_node.go
- create_server.go
- delete_node.go
- delete_server.go
- filter_node_list.go
- filter_server_list.go
- get_server_node_config.go
- get_server_protocols.go
- protocol_keys.go
- query_node_tag.go
- resetsort.go
- service.go
- toggle_node_status.go
- update_node.go
- update_server.go
- update_server_node_config.go