-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
lightning/external: port file.go and necessary codes #45795
Conversation
Hi @lance6716. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #45795 +/- ##
================================================
+ Coverage 73.3504% 73.3771% +0.0266%
================================================
Files 1272 1277 +5
Lines 393076 393894 +818
================================================
+ Hits 288323 289028 +705
- Misses 86373 86469 +96
- Partials 18380 18397 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
// NewKeyValueStore creates a new KeyValueStore. The data will be written to the | ||
// given dataWriter and range properties will be maintained in the given | ||
// rangePropertiesCollector. | ||
func NewKeyValueStore( |
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.
Can we provide an function to clear all data stored in kv store?
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.
I'm not sure about the design from a higher perspective, seems NewKeyValueStore just wraps the writing functionality on external store, and clearing all data is still a functionality of external store itself.
encoded = rc.encode() | ||
require.Greater(t, len(encoded), 0) | ||
|
||
// when not accumulated enough data, no range property will be added. |
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.
How can we enforce collect the range property if not accumulated enough data?
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.
Seems we don't and the code runs fine.
"encoding/binary" | ||
) | ||
|
||
type rangeProperty struct { |
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.
Add more comments about the meaning of the rangeProperty?
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.
I have added comments for some members. I'm not sure about the rest ones.
// size or key count exceeds the given distance, a new range property will be | ||
// appended to the rangePropertiesCollector with current status. | ||
// Caller should guarantee `writerID` and `seq` are not changed. | ||
func (s *KeyValueStore) AddKeyValue(key, value []byte, writerID, seq int) error { |
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.
Will we have batch add function?
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.
The overhead of AddKeyValue
is not much, that's a premature optimization.
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
} | ||
|
||
// FilePathHandle handles data file paths under a prefix path. | ||
type FilePathHandle struct { |
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.
Maybe we can abandon this structure and use []string
instead.
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.
I will think again when port the usage of FilePathHandle
Signed-off-by: lance6716 <lance6716@gmail.com>
writerID int | ||
seq int | ||
offset uint64 | ||
u64Buffer []byte |
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.
Maybe change this field to a local variable var b [8]byte
is better.
Signed-off-by: lance6716 <lance6716@gmail.com>
Signed-off-by: lance6716 <lance6716@gmail.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tangenta, wjhuang2016 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/retest |
@lance6716: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
@lance6716: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Signed-off-by: lance6716 <lance6716@gmail.com>
/retest |
What problem does this PR solve?
Issue Number: ref #45719
Problem Summary:
What is changed and how it works?
Add KeyValueStore which can serialize the KV pair and maintain the range property collector
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.