Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

feature: add storage driver for supernode #446

Merged
merged 1 commit into from
Mar 22, 2019

Conversation

starnop
Copy link
Contributor

@starnop starnop commented Mar 12, 2019

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

@codecov-io
Copy link

codecov-io commented Mar 12, 2019

Codecov Report

Merging #446 into master will increase coverage by 0.28%.
The diff coverage is 63.76%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
common/util/file_util.go 79.41% <0%> (-2.41%) ⬇️
common/util/stat_linux_amd64.go 0% <0%> (ø)
supernode/store/store.go 55% <55%> (ø)
supernode/store/store_mgr.go 61.11% <61.11%> (ø)
supernode/store/local_storage.go 71.22% <71.22%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e7c928...980e1e1. Read the comment docs.

@starnop starnop force-pushed the storage-backend branch 2 times, most recently from 5f61f00 to e77dcd4 Compare March 12, 2019 15:17
}

target := path.Join(dir, key)
return &fileMutex{path: target}, nil
Copy link
Member

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.

}

func getPrefix(str string) string {
return string([]byte(str)[:3])
Copy link
Member

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.

@starnop starnop force-pushed the storage-backend branch 4 times, most recently from 5efd062 to d2825cf Compare March 13, 2019 11:05
@starnop
Copy link
Contributor Author

starnop commented Mar 13, 2019

All mentioned above have been updated. PTAL.

Signed-off-by: Starnop <starnop@163.com>
@lowzj lowzj merged commit c3fc4f1 into dragonflyoss:master Mar 22, 2019
starnop pushed a commit to starnop/Dragonfly that referenced this pull request Nov 27, 2019
feature: add storage driver for supernode
inoc603 pushed a commit to inoc603/Dragonfly that referenced this pull request Dec 23, 2019
feature: add storage driver for supernode
sungjunyoung pushed a commit to sungjunyoung/Dragonfly that referenced this pull request May 8, 2022
Signed-off-by: Jim Ma <majinjing3@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants