diff --git a/dataswamp/services.go b/dataswamp/services.go index c9ea65e..27ae628 100644 --- a/dataswamp/services.go +++ b/dataswamp/services.go @@ -38,7 +38,9 @@ func (s SwampFileService) getOrCreateNs(namespace_in string) *namespace.Namespac time.Now(), s.default_allowance_duration, 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) @@ -93,7 +95,8 @@ func (s SwampFileService) SaveFile(ref swampfile.FileReference, src io.Reader, s f.Close() 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) return nil