able to update file content

having some issue when vi reports file changed.
This commit is contained in:
Chris Lu
2018-05-21 00:00:28 -07:00
parent cd47528a75
commit f07482382b
11 changed files with 209 additions and 124 deletions

View File

@@ -33,14 +33,13 @@ func (filer *MemDbStore) InsertEntry(entry *filer2.Entry) (err error) {
return nil
}
func (filer *MemDbStore) AppendFileChunk(fullpath filer2.FullPath, fileChunks []*filer_pb.FileChunk) (err error) {
func (filer *MemDbStore) SetFileChunks(fullpath filer2.FullPath, fileChunks []*filer_pb.FileChunk) (err error) {
found, entry, err := filer.FindEntry(fullpath)
if !found {
return fmt.Errorf("No such file: %s", fullpath)
}
entry.Chunks = append(entry.Chunks, fileChunks...)
entry.Chunks = fileChunks
entry.Mtime = time.Now()
println("appending to entry", entry.Name(), len(entry.Chunks))
filer.tree.ReplaceOrInsert(Entry{entry})
return nil
}