Interface IPartyService
- Namespace
- FishMMO.Database.Npgsql.Services.Interfaces
- Assembly
- FishMMO-DB.dll
Service interface for party management operations. Provides async methods for party creation, deletion, and retrieval.
public interface IPartyService : IExistsByKeyAction<long>, IDeleteByKeyAction<long>
- Inherited Members
Remarks
Write operations (Create*, Delete*) in this service use execution strategies to ensure transient database failures are automatically retried according to the retry policy configured on the DbContext. Execution is wrapped by BaseService for retries and exception mapping.
All methods return DatabaseResult or DatabaseResult<T> to provide structured error information through the DatabaseException system, helping distinguish between: - Validation failures (invalid parameters) - Not found scenarios (party doesn't exist) - Database errors (connection issues, constraint violations, timeouts) - Entity not found errors - Unexpected runtime errors
Methods
CreateAsync(long, CancellationToken)
Creates a new party and returns the generated party ID.
Task<DatabaseResult<long>> CreateAsync(long worldServerId, CancellationToken cancellationToken = default)
Parameters
worldServerIdlongWorld server the party will belong to.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult<long>>
A DatabaseResult<T> containing the new party ID on success.
Remarks
Parties are independent entities that do not belong to a specific account. Characters join parties through the party membership relationship.
A party belongs to one world server. Characters are global and may be played on any of them, but a party is replicated between scene servers through this database within a single world server's pump — so a party whose members were spread across two would be updated by pumps that cannot see one another and would never converge. Recording the world server here is what lets a membership be dropped when a character arrives somewhere it cannot work.
FetchAsync(long, CancellationToken)
Fetches a party by its ID.
Task<DatabaseResult<PartyData?>> FetchAsync(long partyId, CancellationToken cancellationToken = default)
Parameters
partyIdlongThe party ID.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<DatabaseResult<PartyData?>>
A DatabaseResult<T> containing the party data if found, or null if the party does not exist.