Browse Source
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@4 282b0af5-e82d-9cf1-ede4-77906d7719d0
pull/2/head
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@4 282b0af5-e82d-9cf1-ede4-77906d7719d0
pull/2/head
chris.lu@gmail.com
13 years ago
7 changed files with 199 additions and 67 deletions
-
46weed-fs/note/weedfs.txt
-
18weed-fs/src/cmd/gdir.go
-
57weed-fs/src/cmd/gstore.go
-
18weed-fs/src/pkg/directory/volume_mapping.go
-
70weed-fs/src/pkg/store/store.go
-
22weed-fs/src/pkg/store/util.go
-
15weed-fs/src/pkg/store/volume.go
@ -0,0 +1,46 @@ |
|||
How to submit a content |
|||
1. Find physical volumes |
|||
1.c Create a hash value |
|||
1.d find a write logic volume id, and return [logic volume id, {physical volume ids}] |
|||
2. submit to physical volumes |
|||
2.c |
|||
generate the cookie |
|||
generate a unique id as key |
|||
choose the right altKey |
|||
send bytes to physical volumes |
|||
2.s each |
|||
save bytes |
|||
store map[key uint64, altKey uint32]<offset, size> |
|||
for updated entry, set old entry's offset to zero |
|||
3.c |
|||
wait for all physical volumes to finish |
|||
store the /<logic volume id>/<key>_<cookie>_<altKey>.<ext> |
|||
|
|||
How to retrieve a content |
|||
1.c |
|||
send logic volume id |
|||
1.d |
|||
find least busy volume's id |
|||
2.c |
|||
send URI /<physical volume id>/<key>_<cookie>_<altKey>.<ext> |
|||
|
|||
|
|||
How to submit a content |
|||
1. send bytes to weedfs, got <volume id, key uint64, cookie code> |
|||
store <key uint64, volume id uint32, cookie code uint32, ext>, and other information |
|||
|
|||
To read a content |
|||
2. use logic volume id to lookup a <machine id> |
|||
render url as /<machine id>/<volume id>/<key>/<cookie>.ext |
|||
|
|||
The directory server |
|||
0.init |
|||
load and collect <logic volume id, machine ids> mapping |
|||
1.on submit content |
|||
find a free logic volume id, start sending content to 3 machines |
|||
if all of them finishes, return <logic volume id, key, cookie code> |
|||
2.on read content |
|||
based on logic volume id, pick a machine with less load, |
|||
return <machine id> |
|||
|
|||
|
@ -1,18 +0,0 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"directory" |
|||
// "runtime"
|
|||
"log" |
|||
) |
|||
|
|||
func main() { |
|||
m := directory.NewMapper("/tmp", "directory") |
|||
log.Println("map size", len(m.Virtual2physical)) |
|||
m.Add(10, 11,12,13) |
|||
m.Add(20, 21,22,23) |
|||
log.Println("map(10)", m.Get(10)) |
|||
log.Println("map size", len(m.Virtual2physical)) |
|||
m.Save() |
|||
defer m.Save() |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue