Enforce Identifier on all Services

This commit breaks the Service interface to force all services to have a
global unique identifier. The commit does not enforce any particular
format, but the Reverse Domain Name Notation is recommended.

For reference:
https://en.wikipedia.org/wiki/Reverse_domain_name_notation
This commit is contained in:
diamondburned 2021-03-19 16:52:41 -07:00
parent da5c38eb2f
commit 174496bdf9
3 changed files with 22 additions and 4 deletions

View File

@ -731,9 +731,9 @@ type ServersContainer interface {
SetServers([]Server)
}
// A service is a complete service that's capable of multiple sessions. It has
// to implement the Authenticate() method, which returns multiple
// implementations of Authenticator.
// Service is a complete service that's capable of multiple sessions. It has to
// implement the Authenticate() method, which returns multiple implementations
// of Authenticator.
//
// A service can implement SessionRestorer, which would indicate the frontend
// that it can restore past sessions. Sessions are saved using the SessionSaver
@ -745,6 +745,13 @@ type ServersContainer interface {
// configurations must be optional, as frontends may not implement a
// configurator UI.
type Service interface {
// Identifier returns the unique identifier for the service. There is no
// enforced representation, but services are recommended to follow the Reverse
// Domain Name Notation for consistency. An example of that would be:
//
// com.github.diamondburned.cchat-discord
// com.github.username.service
Identifier
// Namer returns the name of the service.
Namer

Binary file not shown.

View File

@ -651,7 +651,7 @@ var Main = Packages{
},
}, {
Comment: Comment{`
A service is a complete service that's capable of multiple
Service is a complete service that's capable of multiple
sessions. It has to implement the Authenticate() method, which
returns multiple implementations of Authenticator.
@ -668,6 +668,17 @@ var Main = Packages{
`},
Name: "Service",
Embeds: []EmbeddedInterface{{
Comment: Comment{`
Identifier returns the unique identifier for the service. There
is no enforced representation, but services are recommended to
follow the Reverse Domain Name Notation for consistency. An
example of that would be:
com.github.diamondburned.cchat-discord
com.github.username.service
`},
InterfaceName: "Identifier",
}, {
Comment: Comment{`
Namer returns the name of the service.
`},