For the complete documentation index, see llms.txt. This page is also available as Markdown.

Sequence Generators

Responsibilities are generated with external serial numbers and site domain descriptions in the Discussions map.

The sequence generator is responsible for generating numbers by name or business scope. Discussions does not implement a demo serial number service by itself, but declares external serial number requirements in the mapping, which are generated by the data engine and deployed provider.

Topics Use External Ordinal Numbers

Source: src/Zongsoft.Discussions.mapping (excerpt; see source for context).

Zongsoft.Discussions.mapping
<property name="ThreadId" type="ulong" nullable="false" sequence="#" />

# denotes an external sequence. When a business insert method is called, the identifier may not have been generated yet, so a default identifier cannot provide a unique name for a new file. The current content filenames also include a random suffix; see Randomizer.

The Forum Is Divided Into Domains by Site

Source: src/Zongsoft.Discussions.mapping (excerpt; see source for context).

Zongsoft.Discussions.mapping
<property name="ForumId" type="ushort" nullable="false" sequence="#(SiteId)" />

The ForumId's number range is associated with the SiteId. Model relationships and database keys also need to include sites, otherwise identical numbers within different sites will be confused.

Basic Serial Number and Local Number Segment

ISequenceBase expresses basic increment, reset and other capabilities; the framework can also obtain number segment allocation through Variate packaging. The number segment reduces the number of remote calls, but the process exit may leave unused numbers, which cannot guarantee continuity without gaps.

The Discussions listing does not have a fixed sequence generator implementation, the deployer must check the actual provider and name. The framework SequenceTest verifies the number segment growth and reset, and Redis SequenceTest provides specific implementation reference. Don't use fixed intervals in testing as production configurations.

Use Boundaries

Successful number generation does not mean that the business write has been submitted. Rollbacks, retries, and cross-node concurrency all affect number usage. Resetting existing business numbers may also lead to key conflicts, which must be evaluated together with persistent data and cache number segments.

Last updated