|
|
@ -38,7 +38,9 @@ func (s SwampFileService) getOrCreateNs(namespace_in string) *namespace.Namespac
|
|
|
|
time.Now(),
|
|
|
|
time.Now(),
|
|
|
|
s.default_allowance_duration,
|
|
|
|
s.default_allowance_duration,
|
|
|
|
namespace.FileSizeQuota{s.default_allowance_bytes, 0},
|
|
|
|
namespace.FileSizeQuota{s.default_allowance_bytes, 0},
|
|
|
|
namespace.Usage{0, 0, 0, 0, 0},
|
|
|
|
namespace.FileStat{0, 0},
|
|
|
|
|
|
|
|
namespace.FileStat{0, 0},
|
|
|
|
|
|
|
|
namespace.FileStat{0, 0},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
created_ns, err := s.namespace_repo.Create(new_ns)
|
|
|
|
created_ns, err := s.namespace_repo.Create(new_ns)
|
|
|
|
|
|
|
|
|
|
|
@ -93,7 +95,8 @@ func (s SwampFileService) SaveFile(ref swampfile.FileReference, src io.Reader, s
|
|
|
|
|
|
|
|
|
|
|
|
f.Close()
|
|
|
|
f.Close()
|
|
|
|
ns.FileQuota.Add(size)
|
|
|
|
ns.FileQuota.Add(size)
|
|
|
|
ns.Usage = ns.Usage.Downloaded(size)
|
|
|
|
ns.Usage = ns.Usage.Add(size)
|
|
|
|
|
|
|
|
ns.Upload = ns.Upload.Add(size)
|
|
|
|
s.namespace_repo.Update(ns.ID, *ns)
|
|
|
|
s.namespace_repo.Update(ns.ID, *ns)
|
|
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|