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:
parent
da5c38eb2f
commit
174496bdf9
13
cchat.go
13
cchat.go
|
@ -731,9 +731,9 @@ type ServersContainer interface {
|
||||||
SetServers([]Server)
|
SetServers([]Server)
|
||||||
}
|
}
|
||||||
|
|
||||||
// A service is a complete service that's capable of multiple sessions. It has
|
// Service is a complete service that's capable of multiple sessions. It has to
|
||||||
// to implement the Authenticate() method, which returns multiple
|
// implement the Authenticate() method, which returns multiple implementations
|
||||||
// implementations of Authenticator.
|
// of Authenticator.
|
||||||
//
|
//
|
||||||
// A service can implement SessionRestorer, which would indicate the frontend
|
// A service can implement SessionRestorer, which would indicate the frontend
|
||||||
// that it can restore past sessions. Sessions are saved using the SessionSaver
|
// 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
|
// configurations must be optional, as frontends may not implement a
|
||||||
// configurator UI.
|
// configurator UI.
|
||||||
type Service interface {
|
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 returns the name of the service.
|
||||||
Namer
|
Namer
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -651,7 +651,7 @@ var Main = Packages{
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
Comment: Comment{`
|
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
|
sessions. It has to implement the Authenticate() method, which
|
||||||
returns multiple implementations of Authenticator.
|
returns multiple implementations of Authenticator.
|
||||||
|
|
||||||
|
@ -668,6 +668,17 @@ var Main = Packages{
|
||||||
`},
|
`},
|
||||||
Name: "Service",
|
Name: "Service",
|
||||||
Embeds: []EmbeddedInterface{{
|
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{`
|
Comment: Comment{`
|
||||||
Namer returns the name of the service.
|
Namer returns the name of the service.
|
||||||
`},
|
`},
|
||||||
|
|
Loading…
Reference in New Issue