-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature:ETCD key value mvcc #14
Conversation
WalkthroughThis pull request introduces a new Markdown file that contains a complete Go implementation for managing key-value pairs using etcd with multi-version concurrency control (MVCC). The implementation includes functions for creating an etcd client, retrieving key values, managing key-value lifecycle, and handling concurrency. It defines a Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (2)
_posts/2024-11-11-test-markdown.md (2)
1-7
: Consider adding more descriptive metadataThe front matter is properly formatted but could benefit from:
- A more descriptive subtitle explaining the MVCC implementation
- Additional tags like "ETCD", "MVCC", "Distributed-Systems"
92-116
: Enhance MVCC write implementationThe Write method's transaction implementation could be improved for better error handling and clarity.
Consider:
- Adding context with timeout
- Improving error messages
- Adding retry mechanism for write conflicts
-func (lkv *LocalKeyValue) Write(cli *clientv3.Client, newValue string) error { +func (lkv *LocalKeyValue) Write(ctx context.Context, cli *clientv3.Client, newValue string) error { + const maxRetries = 3 + var attempt int + for attempt < maxRetries { + if err := lkv.tryWrite(ctx, cli, newValue); err != nil { + if err == ErrWriteConflict && attempt < maxRetries-1 { + attempt++ + time.Sleep(time.Duration(attempt) * 100 * time.Millisecond) + continue + } + return err + } + return nil + } + return fmt.Errorf("failed to write after %d attempts", maxRetries) }🧰 Tools
🪛 Markdownlint
93-93: Column: 1
Hard tabs(MD010, no-hard-tabs)
94-94: Column: 1
Hard tabs(MD010, no-hard-tabs)
95-95: Column: 1
Hard tabs(MD010, no-hard-tabs)
96-96: Column: 1
Hard tabs(MD010, no-hard-tabs)
97-97: Column: 1
Hard tabs(MD010, no-hard-tabs)
98-98: Column: 1
Hard tabs(MD010, no-hard-tabs)
99-99: Column: 1
Hard tabs(MD010, no-hard-tabs)
100-100: Column: 1
Hard tabs(MD010, no-hard-tabs)
101-101: Column: 1
Hard tabs(MD010, no-hard-tabs)
102-102: Column: 1
Hard tabs(MD010, no-hard-tabs)
103-103: Column: 1
Hard tabs(MD010, no-hard-tabs)
104-104: Column: 1
Hard tabs(MD010, no-hard-tabs)
105-105: Column: 1
Hard tabs(MD010, no-hard-tabs)
106-106: Column: 1
Hard tabs(MD010, no-hard-tabs)
107-107: Column: 1
Hard tabs(MD010, no-hard-tabs)
108-108: Column: 1
Hard tabs(MD010, no-hard-tabs)
109-109: Column: 1
Hard tabs(MD010, no-hard-tabs)
110-110: Column: 1
Hard tabs(MD010, no-hard-tabs)
111-111: Column: 1
Hard tabs(MD010, no-hard-tabs)
112-112: Column: 1
Hard tabs(MD010, no-hard-tabs)
113-113: Column: 1
Hard tabs(MD010, no-hard-tabs)
114-114: Column: 1
Hard tabs(MD010, no-hard-tabs)
115-115: Column: 1
Hard tabs(MD010, no-hard-tabs)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
_posts/2024-11-11-test-markdown.md
(1 hunks)
🧰 Additional context used
🪛 Markdownlint
_posts/2024-11-11-test-markdown.md
16-16: Column: 1
Hard tabs
(MD010, no-hard-tabs)
17-17: Column: 1
Hard tabs
(MD010, no-hard-tabs)
18-18: Column: 1
Hard tabs
(MD010, no-hard-tabs)
20-20: Column: 1
Hard tabs
(MD010, no-hard-tabs)
25-25: Column: 1
Hard tabs
(MD010, no-hard-tabs)
26-26: Column: 1
Hard tabs
(MD010, no-hard-tabs)
27-27: Column: 1
Hard tabs
(MD010, no-hard-tabs)
28-28: Column: 1
Hard tabs
(MD010, no-hard-tabs)
29-29: Column: 1
Hard tabs
(MD010, no-hard-tabs)
30-30: Column: 1
Hard tabs
(MD010, no-hard-tabs)
31-31: Column: 1
Hard tabs
(MD010, no-hard-tabs)
32-32: Column: 1
Hard tabs
(MD010, no-hard-tabs)
33-33: Column: 1
Hard tabs
(MD010, no-hard-tabs)
34-34: Column: 1
Hard tabs
(MD010, no-hard-tabs)
39-39: Column: 1
Hard tabs
(MD010, no-hard-tabs)
40-40: Column: 1
Hard tabs
(MD010, no-hard-tabs)
41-41: Column: 1
Hard tabs
(MD010, no-hard-tabs)
42-42: Column: 1
Hard tabs
(MD010, no-hard-tabs)
43-43: Column: 1
Hard tabs
(MD010, no-hard-tabs)
44-44: Column: 1
Hard tabs
(MD010, no-hard-tabs)
45-45: Column: 1
Hard tabs
(MD010, no-hard-tabs)
46-46: Column: 1
Hard tabs
(MD010, no-hard-tabs)
47-47: Column: 1
Hard tabs
(MD010, no-hard-tabs)
52-52: Column: 1
Hard tabs
(MD010, no-hard-tabs)
53-53: Column: 1
Hard tabs
(MD010, no-hard-tabs)
54-54: Column: 1
Hard tabs
(MD010, no-hard-tabs)
58-58: Column: 1
Hard tabs
(MD010, no-hard-tabs)
59-59: Column: 1
Hard tabs
(MD010, no-hard-tabs)
60-60: Column: 1
Hard tabs
(MD010, no-hard-tabs)
61-61: Column: 1
Hard tabs
(MD010, no-hard-tabs)
62-62: Column: 1
Hard tabs
(MD010, no-hard-tabs)
67-67: Column: 1
Hard tabs
(MD010, no-hard-tabs)
68-68: Column: 1
Hard tabs
(MD010, no-hard-tabs)
69-69: Column: 1
Hard tabs
(MD010, no-hard-tabs)
70-70: Column: 1
Hard tabs
(MD010, no-hard-tabs)
71-71: Column: 1
Hard tabs
(MD010, no-hard-tabs)
72-72: Column: 1
Hard tabs
(MD010, no-hard-tabs)
73-73: Column: 1
Hard tabs
(MD010, no-hard-tabs)
74-74: Column: 1
Hard tabs
(MD010, no-hard-tabs)
75-75: Column: 1
Hard tabs
(MD010, no-hard-tabs)
76-76: Column: 1
Hard tabs
(MD010, no-hard-tabs)
77-77: Column: 1
Hard tabs
(MD010, no-hard-tabs)
78-78: Column: 1
Hard tabs
(MD010, no-hard-tabs)
79-79: Column: 1
Hard tabs
(MD010, no-hard-tabs)
80-80: Column: 1
Hard tabs
(MD010, no-hard-tabs)
81-81: Column: 1
Hard tabs
(MD010, no-hard-tabs)
82-82: Column: 1
Hard tabs
(MD010, no-hard-tabs)
83-83: Column: 1
Hard tabs
(MD010, no-hard-tabs)
88-88: Column: 1
Hard tabs
(MD010, no-hard-tabs)
93-93: Column: 1
Hard tabs
(MD010, no-hard-tabs)
94-94: Column: 1
Hard tabs
(MD010, no-hard-tabs)
95-95: Column: 1
Hard tabs
(MD010, no-hard-tabs)
96-96: Column: 1
Hard tabs
(MD010, no-hard-tabs)
97-97: Column: 1
Hard tabs
(MD010, no-hard-tabs)
98-98: Column: 1
Hard tabs
(MD010, no-hard-tabs)
99-99: Column: 1
Hard tabs
(MD010, no-hard-tabs)
100-100: Column: 1
Hard tabs
(MD010, no-hard-tabs)
101-101: Column: 1
Hard tabs
(MD010, no-hard-tabs)
102-102: Column: 1
Hard tabs
(MD010, no-hard-tabs)
103-103: Column: 1
Hard tabs
(MD010, no-hard-tabs)
104-104: Column: 1
Hard tabs
(MD010, no-hard-tabs)
105-105: Column: 1
Hard tabs
(MD010, no-hard-tabs)
106-106: Column: 1
Hard tabs
(MD010, no-hard-tabs)
107-107: Column: 1
Hard tabs
(MD010, no-hard-tabs)
108-108: Column: 1
Hard tabs
(MD010, no-hard-tabs)
109-109: Column: 1
Hard tabs
(MD010, no-hard-tabs)
110-110: Column: 1
Hard tabs
(MD010, no-hard-tabs)
111-111: Column: 1
Hard tabs
(MD010, no-hard-tabs)
112-112: Column: 1
Hard tabs
(MD010, no-hard-tabs)
113-113: Column: 1
Hard tabs
(MD010, no-hard-tabs)
114-114: Column: 1
Hard tabs
(MD010, no-hard-tabs)
115-115: Column: 1
Hard tabs
(MD010, no-hard-tabs)
119-119: Column: 1
Hard tabs
(MD010, no-hard-tabs)
120-120: Column: 1
Hard tabs
(MD010, no-hard-tabs)
121-121: Column: 1
Hard tabs
(MD010, no-hard-tabs)
122-122: Column: 1
Hard tabs
(MD010, no-hard-tabs)
123-123: Column: 1
Hard tabs
(MD010, no-hard-tabs)
124-124: Column: 1
Hard tabs
(MD010, no-hard-tabs)
126-126: Column: 1
Hard tabs
(MD010, no-hard-tabs)
128-128: Column: 1
Hard tabs
(MD010, no-hard-tabs)
129-129: Column: 1
Hard tabs
(MD010, no-hard-tabs)
130-130: Column: 1
Hard tabs
(MD010, no-hard-tabs)
131-131: Column: 1
Hard tabs
(MD010, no-hard-tabs)
132-132: Column: 1
Hard tabs
(MD010, no-hard-tabs)
133-133: Column: 1
Hard tabs
(MD010, no-hard-tabs)
134-134: Column: 1
Hard tabs
(MD010, no-hard-tabs)
135-135: Column: 1
Hard tabs
(MD010, no-hard-tabs)
136-136: Column: 1
Hard tabs
(MD010, no-hard-tabs)
137-137: Column: 1
Hard tabs
(MD010, no-hard-tabs)
138-138: Column: 1
Hard tabs
(MD010, no-hard-tabs)
139-139: Column: 1
Hard tabs
(MD010, no-hard-tabs)
141-141: Column: 1
Hard tabs
(MD010, no-hard-tabs)
142-142: Column: 1
Hard tabs
(MD010, no-hard-tabs)
143-143: Column: 1
Hard tabs
(MD010, no-hard-tabs)
145-145: Column: 1
Hard tabs
(MD010, no-hard-tabs)
146-146: Column: 1
Hard tabs
(MD010, no-hard-tabs)
147-147: Column: 1
Hard tabs
(MD010, no-hard-tabs)
149-149: Column: 1
Hard tabs
(MD010, no-hard-tabs)
150-150: Column: 1
Hard tabs
(MD010, no-hard-tabs)
151-151: Column: 1
Hard tabs
(MD010, no-hard-tabs)
152-152: Column: 1
Hard tabs
(MD010, no-hard-tabs)
153-153: Column: 1
Hard tabs
(MD010, no-hard-tabs)
Please note that if you are trying to update your website, this is the wrong place to do so. Please carefully follow the Beautiful Jekyll instructions (found at https://github.com/daattali/beautiful-jekyll#readme) and make sure you submit changes to your version of the project.
If your intention is to submit a Pull Request, please describe what your pull request achieves.
Thank you!
Summary by CodeRabbit
New Features
Documentation