Browse Source

fix bug: filer DELETE

pull/315/head
DaLin 9 years ago
parent
commit
fa2a7b5f2f
  1. 6
      weed/filer/cassandra_store/cassandra_store.go
  2. 14
      weed/filer/flat_namespace/flat_namespace_filer.go
  3. 2
      weed/filer/flat_namespace/flat_namespace_store.go
  4. 4
      weed/filer/redis_store/redis_store.go

6
weed/filer/cassandra_store/cassandra_store.go

@ -68,16 +68,16 @@ func (c *CassandraStore) Get(fullFileName string) (fid string, err error) {
} }
// Currently the fid is not returned // Currently the fid is not returned
func (c *CassandraStore) Delete(fullFileName string) (fid string, err error) {
func (c *CassandraStore) Delete(fullFileName string) (err error) {
if err := c.session.Query( if err := c.session.Query(
`DELETE FROM seaweed_files WHERE path = ?`, `DELETE FROM seaweed_files WHERE path = ?`,
fullFileName).Exec(); err != nil { fullFileName).Exec(); err != nil {
if err != gocql.ErrNotFound { if err != gocql.ErrNotFound {
glog.V(0).Infof("Failed to delete file %s: %v", fullFileName, err) glog.V(0).Infof("Failed to delete file %s: %v", fullFileName, err)
} }
return "", err
return err
} }
return "", nil
return nil
} }
func (c *CassandraStore) Close() { func (c *CassandraStore) Close() {

14
weed/filer/flat_namespace/flat_namespace_filer.go

@ -42,7 +42,19 @@ func (filer *FlatNamespaceFiler) DeleteDirectory(dirPath string, recursive bool)
} }
func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, err error) { func (filer *FlatNamespaceFiler) DeleteFile(fullFileName string) (fid string, err error) {
return filer.store.Delete(fullFileName)
fid, err = filer.FindFile(fullFileName)
if err != nil {
return "", err
}
err = filer.store.Delete(fullFileName)
if err != nil {
return "", err
}
return fid, nil
//return filer.store.Delete(fullFileName)
//are you kidding me!!!!
} }
func (filer *FlatNamespaceFiler) Move(fromPath string, toPath string) error { func (filer *FlatNamespaceFiler) Move(fromPath string, toPath string) error {

2
weed/filer/flat_namespace/flat_namespace_store.go

@ -5,5 +5,5 @@ import ()
type FlatNamespaceStore interface { type FlatNamespaceStore interface {
Put(fullFileName string, fid string) (err error) Put(fullFileName string, fid string) (err error)
Get(fullFileName string) (fid string, err error) Get(fullFileName string) (fid string, err error)
Delete(fullFileName string) (fid string, err error)
Delete(fullFileName string) (err error)
} }

4
weed/filer/redis_store/redis_store.go

@ -33,12 +33,12 @@ func (s *RedisStore) Put(fullFileName string, fid string) (err error) {
} }
// Currently the fid is not returned // Currently the fid is not returned
func (s *RedisStore) Delete(fullFileName string) (fid string, err error) {
func (s *RedisStore) Delete(fullFileName string) (err error) {
_, err = s.Client.Del(fullFileName).Result() _, err = s.Client.Del(fullFileName).Result()
if err == redis.Nil { if err == redis.Nil {
err = nil err = nil
} }
return "", err
return err
} }
func (s *RedisStore) Close() { func (s *RedisStore) Close() {

Loading…
Cancel
Save