Skip to content

Refactor dict#173

Merged
bjosv merged 10 commits intovalkey-io:mainfrom
bjosv:refactor-dict
Mar 6, 2025
Merged

Refactor dict#173
bjosv merged 10 commits intovalkey-io:mainfrom
bjosv:refactor-dict

Conversation

@bjosv
Copy link
Copy Markdown
Collaborator

@bjosv bjosv commented Mar 4, 2025

To be able to use dict from Valkey I have found that following changes would be needed

  • Rename dictSetHash* to dictSet* (matching API)
  • Rename dictGetEntry* to dictGet* (matching API)
  • Make dictEntry opaque
    This matches the dictEntry is valkey which also is opaque.
  • Remove unused privdata from dict.
    Since the privdata pointer is not used in libvalkey we can remove it.
  • Initiate dictType's using designated initializers (C99)
    Allows us to handle different ordering in the dictType struct.
  • Duplicate dict value explicitly to avoid using valDup
    Valkeys dict type don't have valDup, i.e a function that can copy the inserted data.
    We can avoid this difference by manually copy the value.
  • Update dictType signatures to match dict in Valkey.
    callbackHash returns an unsigned long int in valkey, we can use that as well.

With these changes we would be able to build libvalkey using dict from valkeys repos in its current state.

bjosv added 8 commits March 4, 2025 11:00
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
This matches the dictEntry is valkey which also is opaque.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Since the privdata pointer is not used in libvalkey we can remove it.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Enables us to use Valkeys dict type which dont have valdup.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
- Fetch new apt-packages before installing valkey in CI
- Replace ubuntu 20.04 since the runner will be removed 2025-04-01.
- Change gcc/clang to use runner available versions.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
@zuiderkwast
Copy link
Copy Markdown
Collaborator

We'll most likely vendor it as before. We don't use git submodules now so that would be a large change to the tool chain, source releases, etc.

Copy link
Copy Markdown
Collaborator

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Looks like a cleanup. More lines deleted than added. That's always nice.

Comment thread src/cluster.c Outdated
@bjosv bjosv merged commit 136ede0 into valkey-io:main Mar 6, 2025
@bjosv bjosv deleted the refactor-dict branch March 6, 2025 04:36
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