facebook / facebook/folly

How to Implement Key-Value Storage Using `folly::ConcurrentSkipList`?

Open
#2,417 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

I'm trying to use folly::ConcurrentSkipList to implement a key-value store where each key maps to a single value, similar to std::map. However, the current implementation and documentation seem to focus on key-only usage (like std::set), and do not provide examples or guidance on how to store both key and value in the skip list.

From my understanding of folly::ConcurrentSkipList, it is designed for unique keys, like std::set, but I need to store both a key and its associated value. I am unsure how to modify the container or use an accessor to store and retrieve a key-value pair efficiently while ensuring the following:
- Lock-free or highly efficient thread-safe operations (insert, update, delete, and retrieval).
- Efficient handling of insertions, updates, deletions, and retrievals while maintaining the benefits of the skip list in terms of sorted access and concurrency.

Could you provide guidance on:
- How to implement key-value pairs using folly::ConcurrentSkipList?
- Best practices for handling operations (insert, update, delete, retrieve) while ensuring efficient thread-safe access?
- Ensuring the implementation remains lock-free or at least minimizes locking to ensure high concurrency and scalability?

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reading the folly::ConcurrentSkipList documentation and implementation to determine whether key-value storage is supported or requires a separate pattern. Done would be clear guidance covering representation and thread-safe insert, update, delete, and retrieval operations, ideally with an example.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.