Conversation
- IIdGenerator<TKey> (Initial + Next) models a successor-based id strategy - IdGenerators.Int32/Int64 factories for the common integral keys
- PersistenceStateStore keeps a per-type high-water key (GetLastKey/SetLastKey), cleared with buckets - descriptor gains optional keySetter + idGenerator; AllocateNextKey, NoteKey (max, never lowers), IsDefaultKey, SetKey, and high-water serialize/load hooks - an auto-id registration requires a keySetter
…ter on replay - EntityStore.UpsertAsync allocates the next key when an auto-id entity has a default key, writes it back onto the clone and the caller's instance, and advances the high-water on explicit keys - descriptor ApplyUpsert notes the key so journal replay resumes numbering without reuse - add internal IInternalAutoIdDescriptor seam so EntityStore reaches auto-id ops through the interface
…terPersistedEntity - snapshot captures per-type high-water keys into a reserved bucket (type id 65535) and restores them on load - RegisterPersistedEntity gains optional keySetter + idGenerator; rejects the reserved type id - ids continue across restart and never regress after deleting the highest entity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds opt-in server-assigned keys to SquidStd.Persistence.
What
IIdGenerator<TKey>(Initial + Next) with built-inIdGenerators.Int32/Int64RegisterPersistedEntitygains optionalkeySetter+idGenerator; when a generator is supplied the type is auto-idEntityStore.UpsertAsyncassigns the next key when the caller leaves it at default, writing it back onto the entityCompatibility
keySelector-only registrations and the descriptor constructor are unchangedTests