Documentation
¶
Overview ¶
Package space answers "how much room is there?" for every surface a client asks it through: SFTP's statvfs@openssh.com, NFS FSSTAT, FTP AVBL, WebDAV's RFC 4331 quota properties, and `filex mount` (the manager API's action=space).
Why one answer ¶
Each of those used to make up its own number: the account's quota when it had one, a round figure when it did not, and the figure was different on every surface (SFTP and the Linux mount said 1 PiB, NFS 32 TiB, FTP 1 TiB, the Windows mount 4 TiB half full, /dav nothing). A local storage on a RAID volume showed up in Windows Explorer as a 1 PB drive with nothing used (issue #116).
What the answer is ¶
- A path inside a storage: what the storage itself reports for it (storage.SpaceOf: the disk, the share, the server), capped by the account's quota when it has one.
- The virtual root, the folder that lists the storages: the storages the caller can see, added up, a disk two of them share counted once. A client that maps the whole server as a drive asks about the root.
- Nothing measurable (an object store, a driver that cannot say, a backend that did not answer) and no quota: Known is false and the surface answers with OrStandIn, large and finite, because zero makes WinSCP and Explorer report a full disk and refuse to copy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Figures ¶
type Figures struct {
Total uint64 `json:"total"`
Used uint64 `json:"used"`
// Free is what the caller could still write.
Free uint64 `json:"free"`
// Known is false when nothing could be measured and no quota applies.
Known bool `json:"known"`
}
Figures is the room at one location, in bytes.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service answers for storages and for the virtual root. One per server, so every surface shares the cache.
func Ensure ¶
Ensure returns s, or a service of its own over resolve and q when s is nil: a protocol server whose wiring line was lost still answers with real figures, only without the shared cache.
func New ¶
New builds a service over the live driver resolver and the quota service (nil: no account has a quota).