-
Notifications
You must be signed in to change notification settings - Fork 774
feature: add storage driver for supernode #446
Conversation
0e49d91
to
b925271
Compare
Codecov Report
@@ Coverage Diff @@
## master #446 +/- ##
==========================================
+ Coverage 59.26% 59.54% +0.28%
==========================================
Files 57 61 +4
Lines 2855 3063 +208
==========================================
+ Hits 1692 1824 +132
- Misses 1082 1126 +44
- Partials 81 113 +32
Continue to review full report at Codecov.
|
5f61f00
to
e77dcd4
Compare
supernode/store/local_storage.go
Outdated
} | ||
|
||
target := path.Join(dir, key) | ||
return &fileMutex{path: target}, nil |
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.
From the way of the later use, this does not achieve the purpose of safely reading and writing a same file in different coroutines. Because that the return value fileMutex
is created every times, they're different objects when we reading or writing a same file in multi-coroutines. So the mutex does not work as what you want.
supernode/store/local_storage.go
Outdated
} | ||
|
||
func getPrefix(str string) string { | ||
return string([]byte(str)[:3]) |
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.
Here should check whether the length of str
is greater than 3.
5efd062
to
d2825cf
Compare
All mentioned above have been updated. PTAL. |
Signed-off-by: Starnop <starnop@163.com>
d2825cf
to
980e1e1
Compare
feature: add storage driver for supernode
feature: add storage driver for supernode
Signed-off-by: Jim Ma <majinjing3@gmail.com>
Signed-off-by: Starnop starnop@163.com
Ⅰ. Describe what this PR did
The supernode will use cdn to cache the files which downloaded from the source web server. However, using local storage is not a one-size-fits-all approach. So we define an interface
StorageDriver
that defines all the storage driver behavior to support different storage drivers.In addition, we may use multiple storage drivers for different contents at the same time. So there is a
Manager
to manage multiple storage drivers.You can understand it easily according to the follow image:
And I have implement a local driver as a demo.
Ⅱ. Does this pull request fix one issue?
#139
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Added.
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews