Skip to content

generic hashtable template with optional locking mask #148

@thinkingfish

Description

@thinkingfish

There are 4 hashtables in Pelikan now, each only very slightly different. In general if we can create a hashtable template with the following components pluggable, we can serve them all. This is likely gonna require more macros, but we do use cc_queue.h anyway.

  • type of hash node
  • type of "key" to build hash from
  • hash function used (against key)
  • comparison function on "key"

Additionally, it'd be nice to provide built-in per-entry locking support. This can be achieved by having an bit-mask for all entries, and set the corresponding bit to true when an entry is being accessed. The granularity of the lock can be adjusted by changing the mapping between bit-mask and hash entry (e.g. 2**n entries mapping to the same bit in mask, n being configurable).

Of course, if only we use a language that has proper templating...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions