Clarified ID uniqueness
This commit clarifies the rules regarding ID uniqueness and guarantees when it comes to the backend and frontend. This piece of documentation was added into the top package section.
This commit is contained in:
parent
ea2c12d119
commit
e59ab2dbf1
10
cchat.go
10
cchat.go
|
@ -6,6 +6,16 @@
|
|||
//
|
||||
// Backend
|
||||
//
|
||||
// Almost anything in the backend comes with an ID. For example, a Server must
|
||||
// have an ID, or a Session must have a user ID. The backend is required to
|
||||
// guarantee that IDs are somehow unique. This should already be the case for
|
||||
// most chat services; for example, Discord provides IDs for guilds, channels,
|
||||
// members, and more. The only time that the backend should not guarantee ID
|
||||
// uniqueness is across Sessions, because it doesn't make sense to do so. In
|
||||
// this case, the frontend should guarantee uniqueness instead, either by
|
||||
// discarding duplicated items, overriding them, or anything reasonable and
|
||||
// explicit.
|
||||
//
|
||||
// Methods implemented by the backend that have frontend containers as arguments
|
||||
// can do IO. Frontends must NOT rely on individual backend states and should
|
||||
// always assume that they will block.
|
||||
|
|
|
@ -339,6 +339,17 @@ var Main = Packages{
|
|||
|
||||
Backend
|
||||
|
||||
Almost anything in the backend comes with an ID. For example, a
|
||||
Server must have an ID, or a Session must have a user ID. The
|
||||
backend is required to guarantee that IDs are somehow unique. This
|
||||
should already be the case for most chat services; for example,
|
||||
Discord provides IDs for guilds, channels, members, and more. The
|
||||
only time that the backend should not guarantee ID uniqueness is
|
||||
across Sessions, because it doesn't make sense to do so. In this
|
||||
case, the frontend should guarantee uniqueness instead, either by
|
||||
discarding duplicated items, overriding them, or anything
|
||||
reasonable and explicit.
|
||||
|
||||
Methods implemented by the backend that have frontend containers as
|
||||
arguments can do IO. Frontends must NOT rely on individual backend
|
||||
states and should always assume that they will block.
|
||||
|
|
Loading…
Reference in New Issue