Hideya OHASHI avatar Hideya OHASHI committed 7668f4b

save

Comments (0)

Files changed (3)

+naming = icedfs = iced fs or ice dfs
+
 = basics
+* global config
+* add directory UI
+  * 'sdfs config add /home/foo/bar' and auto 'sdfs config put'
+  * 'sdfs config show' support
+  * anothor .sdfs.yaml support
 * use tempfile and tmpdir
 * thread safe / multiuser / merge support
 * put multiple files
 * balancer
 * handle media full
 
+= bugs
+* 'sdfs cat foo' shows 'warning: digest' if chunk is corrupted
+
 = advanced
+* df
 * du/dus
 * lsr
 * head/tail
   def put(src, digest)
     begin
       FileUtils.mkdir_p('%s/chunk' % @url)
+      FileUtils.touch("#{@url}/chunk/placeholder")
       FileUtils.cp(src, '%s/chunk/%s' % [ @url, digest ])
       true
     rescue Errno::EACCES, Errno::EEXIST
     str = `cd #{@url}/chunk && sha256sum *`
     result = true
     str.each_line do |l|
-      file, digest = l.split
+      digest, file = l.split
+      next if file == 'placeholder'
       if file != digest
         unless quiet
           puts "#{@url} has a bad chunk." # TODO fix when?
-          puts file
-          puts digest
+          puts file[0, 12]
+          puts digest[0, 12]
         end
+        FileUtils.mkdir_p("#{@url}/badchunk")
+        FileUtils.mv("#{@url}/chunk/#{file}", "#{@url}/badchunk")
         result = false
       end
     end
       result = true
       open("/tmp/sha256.txt", 'r') do |f|
         f.each_line do |l|
-          file, digest = l.split
+          digest, file = l.split
           if digest.index(file) < 0
             unless quiet
               puts "#{@url} has a bad chunk." # TODO fix when?
   puts lstxt if lstxt.size > 0
 when 'cat'
   file = ARGV.shift
-  print dfs.get(file)
+  print dfs.get(file, false)
 when 'get'
   src = ARGV.shift
   dest = ARGV.shift
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.