Table of Contents

Interface ICharacterFriendService

Namespace
FishMMO.Database.Npgsql.Services.Interfaces
Assembly
FishMMO-DB.dll

Service interface for managing character friend relationships.

public interface ICharacterFriendService : ICountByKeyAction<long>, IDeleteByKeyVersionedAction<long>, IFetchCollectionByKeyAction<long, CharacterFriendData>
Inherited Members

Remarks

Friend link deletion is expected to be version-gated via the logical Version so stale updates are rejected and newer authoritative updates win.

Methods

DeleteAsync(long, long, long, CancellationToken)

Deletes a friend relationship for the specified character if incomingVersion is newer.

Task<DatabaseResult> DeleteAsync(long characterId, long friendCharacterId, long incomingVersion, CancellationToken cancellationToken = default)

Parameters

characterId long

The owning character ID.

friendCharacterId long

The friend character ID.

incomingVersion long

The authoritative, monotonic version for this delete operation.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<DatabaseResult>

A DatabaseResult indicating success or failure.

IsBlockedAsync(long, long, CancellationToken)

Determines whether characterId has blocked otherCharacterId.

Task<DatabaseResult<bool>> IsBlockedAsync(long characterId, long otherCharacterId, CancellationToken cancellationToken = default)

Parameters

characterId long

The character who may own a block entry.

otherCharacterId long

The character who may be blocked.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<DatabaseResult<bool>>

A DatabaseResult<T> that is true when an active row exists marking otherCharacterId as blocked by characterId.

Remarks

The is_blocked column has existed since the friend table was introduced and nothing has ever read it — every block a player recorded was written and then ignored, so blocking someone did not stop them inviting or whispering. This is the read side. The check is deliberately one-directional: it answers "has A blocked B", so the caller must ask it about the TARGET of an unwanted action, not about the initiator.

PersistAsync(long, long, long, bool, CancellationToken)

Persists a friend or block relationship for the specified character.

Task<DatabaseResult> PersistAsync(long characterId, long friendCharacterId, long incomingVersion, bool isBlocked, CancellationToken cancellationToken = default)

Parameters

characterId long

The owning character ID.

friendCharacterId long

The friend character ID.

incomingVersion long

The authoritative, monotonic version for this persist operation.

isBlocked bool

When true the relationship is a block; when false it is a friend.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<DatabaseResult>

A DatabaseResult indicating success or failure.