Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New state system #945

Merged
merged 36 commits into from
Jun 3, 2021
Merged

New state system #945

merged 36 commits into from
Jun 3, 2021

Conversation

jogramming
Copy link
Contributor

@jogramming jogramming commented May 24, 2021

This is a draft pr tracking my progress on the new state system.

There's probably still a couple things i will change on the design but the higher level structure of it is set.

As for why there's a new state system can be found here: https://github.com/jonas747/dstate/blob/v3/README.md

jonas747 added 12 commits May 27, 2021 00:40
This is a new package that provides a pretty simple cache
system based on "slots",

each cached type has it's own "slot" and managed all the
cached values inside it on its own

values inside a "slot" are keyed by interface{}
so the user can use whatever key type they want
but the most common one will probably be int64
MemberState no longer contains roles and nickname, they're in the nested member object

this is to increase support for future discord api versions where presences are less usefull
I believe discord has fixed the issues where JoinedAt was not available
atleast im not able to find any such cases anymore

And with the roles and nick fields being moved to the
member fields for dstate.MemberState, all calls to bot.GetMember
requires the member field to be set to use the cached version.
@jogramming
Copy link
Contributor Author

This is getting close, there's just a small number of tasks left:

  • Update shard migration to support the new state system (might require a small modifcation to dstate.InMemoryTracker)
  • Add members to cache from the member fetcher (might require a small modifcation to dstate.InMemoryTracker)
  • Ensure backwards compat with custom commands/templates
  • testing testing testing

Copy link
Contributor Author

@jogramming jogramming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally done going over 147 files

bot/botrest/server.go Outdated Show resolved Hide resolved
commands/util.go Outdated Show resolved Hide resolved
common/templates/context.go Outdated Show resolved Hide resolved
common/templates/context_funcs.go Outdated Show resolved Hide resolved
customcommands/web.go Outdated Show resolved Hide resolved
moderation/punishments.go Show resolved Hide resolved
reputation/reputation.go Show resolved Hide resolved
@jogramming jogramming marked this pull request as ready for review June 3, 2021 16:41
@jogramming jogramming merged commit afe4ff8 into dev Jun 3, 2021
jo3-l pushed a commit to jo3-l/yagpdb that referenced this pull request Jun 3, 2021
* initial work on new state system

* state: intial version of new state system and basic embedded tracker

* progress

* more progress

* update go.mod

* add CacheSet replacement for GuildState.Userstate

This is a new package that provides a pretty simple cache
system based on "slots",

each cached type has it's own "slot" and managed all the
cached values inside it on its own

values inside a "slot" are keyed by interface{}
so the user can use whatever key type they want
but the most common one will probably be int64

* more progress moving to the new state and caching sytem

* continued work on migrating to the new state and cache system

* we compiled now bois

* update to latest dcmd and dstate

MemberState no longer contains roles and nickname, they're in the nested member object

this is to increase support for future discord api versions where presences are less usefull

* remove bot.GetMemberJoinedAt as it's not needed

I believe discord has fixed the issues where JoinedAt was not available
atleast im not able to find any such cases anymore

And with the roles and nick fields being moved to the
member fields for dstate.MemberState, all calls to bot.GetMember
requires the member field to be set to use the cached version.

* common: run CacheSet gc loop in goroutine

* bot: fix not setting proper state in setupState

* automodv2: fix panic in CheckTriggers

* tickets: fix build

* premium: fix deadlocking state

* update to latest dstate

* enabled shard migration, added state debug commands

* update to latest dshardorchestrator, go mod tidy

* accidentally included some compiled files

* add a couple more executables to gitignore

* memberfetcher: add results to state, properly set guildid

* bot: run state gc loop

* udpate to latest dstate

* templates: fixes and tweaks

* fix a bunch of warnings

* update to latest dcmd

* update to latest dcmd

* web: fixes for new state system

* botrest: use bot.GetMember to fallback to api

* commands: simplify a section

* templates: use user reference to keep backwards compat

* templates: fix referencing looping var

* pubsub: change EvictCacheSet to not require a guildID

* undelete: fix build
jo3-l pushed a commit to jo3-l/yagpdb that referenced this pull request Jun 3, 2021
* initial work on new state system

* state: intial version of new state system and basic embedded tracker

* progress

* more progress

* update go.mod

* add CacheSet replacement for GuildState.Userstate

This is a new package that provides a pretty simple cache
system based on "slots",

each cached type has it's own "slot" and managed all the
cached values inside it on its own

values inside a "slot" are keyed by interface{}
so the user can use whatever key type they want
but the most common one will probably be int64

* more progress moving to the new state and caching sytem

* continued work on migrating to the new state and cache system

* we compiled now bois

* update to latest dcmd and dstate

MemberState no longer contains roles and nickname, they're in the nested member object

this is to increase support for future discord api versions where presences are less usefull

* remove bot.GetMemberJoinedAt as it's not needed

I believe discord has fixed the issues where JoinedAt was not available
atleast im not able to find any such cases anymore

And with the roles and nick fields being moved to the
member fields for dstate.MemberState, all calls to bot.GetMember
requires the member field to be set to use the cached version.

* common: run CacheSet gc loop in goroutine

* bot: fix not setting proper state in setupState

* automodv2: fix panic in CheckTriggers

* tickets: fix build

* premium: fix deadlocking state

* update to latest dstate

* enabled shard migration, added state debug commands

* update to latest dshardorchestrator, go mod tidy

* accidentally included some compiled files

* add a couple more executables to gitignore

* memberfetcher: add results to state, properly set guildid

* bot: run state gc loop

* udpate to latest dstate

* templates: fixes and tweaks

* fix a bunch of warnings

* update to latest dcmd

* update to latest dcmd

* web: fixes for new state system

* botrest: use bot.GetMember to fallback to api

* commands: simplify a section

* templates: use user reference to keep backwards compat

* templates: fix referencing looping var

* pubsub: change EvictCacheSet to not require a guildID

* undelete: fix build
@ashishjh-bst ashishjh-bst deleted the feature-new-state-system branch February 10, 2022 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants